[TS] Update auto-generated bindings (with RGS)
[ldk-java] / ts / bindings.c.body
1 #include "js-wasm.h"
2 #include <stdatomic.h>
3 #include <lightning.h>
4
5 // These should be provided...somehow...
6 void *memset(void *s, int c, size_t n);
7 void *memcpy(void *dest, const void *src, size_t n);
8 int memcmp(const void *s1, const void *s2, size_t n);
9
10 extern void __attribute__((noreturn)) abort(void);
11 static inline void assert(bool expression) {
12         if (!expression) { abort(); }
13 }
14
15 uint32_t __attribute__((export_name("test_bigint_pass_deadbeef0badf00d"))) test_bigint_pass_deadbeef0badf00d(uint64_t val) {
16         return val == 0xdeadbeef0badf00dULL;
17 }
18
19
20 void *malloc(size_t size);
21 void free(void *ptr);
22
23 #define MALLOC(a, _) malloc(a)
24 #define do_MALLOC(a, _b, _c) malloc(a)
25 #define FREE(p) if ((unsigned long)(p) > 4096) { free(p); }
26 #define DO_ASSERT(a) (void)(a)
27 #define CHECK(a)
28 #define CHECK_ACCESS(p)
29 #define CHECK_INNER_FIELD_ACCESS_OR_NULL(v)
30
31 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
32 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
33 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
34 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
35
36 _Static_assert(sizeof(void*) == 4, "Pointers mut be 32 bits");
37
38 #define DECL_ARR_TYPE(ty, name) \
39         struct name##array { \
40                 uint64_t arr_len; /* uint32_t would suffice but we want to align uint64_ts as well */ \
41                 ty elems[]; \
42         }; \
43         typedef struct name##array * name##Array; \
44         static inline name##Array init_##name##Array(size_t arr_len, int lineno) { \
45                 name##Array arr = (name##Array)do_MALLOC(arr_len * sizeof(ty) + sizeof(uint64_t), #name" array init", lineno); \
46                 arr->arr_len = arr_len; \
47                 return arr; \
48         }
49
50 DECL_ARR_TYPE(int64_t, int64_t);
51 DECL_ARR_TYPE(uint64_t, uint64_t);
52 DECL_ARR_TYPE(int8_t, int8_t);
53 DECL_ARR_TYPE(uint32_t, uint32_t);
54 DECL_ARR_TYPE(void*, ptr);
55 DECL_ARR_TYPE(char, char);
56 typedef charArray jstring;
57
58 static inline jstring str_ref_to_ts(const char* chars, size_t len) {
59         charArray arr = init_charArray(len, __LINE__);
60         memcpy(arr->elems, chars, len);
61         return arr;
62 }
63 static inline LDKStr str_ref_to_owned_c(const jstring str) {
64         char* newchars = MALLOC(str->arr_len + 1, "String chars");
65         memcpy(newchars, str->elems, str->arr_len);
66         newchars[str->arr_len] = 0;
67         LDKStr res = {
68                 .chars = newchars,
69                 .len = str->arr_len,
70                 .chars_is_owned = true
71         };
72         return res;
73 }
74
75 typedef bool jboolean;
76
77 uint32_t __attribute__((export_name("TS_malloc"))) TS_malloc(uint32_t size) {
78         return (uint32_t)MALLOC(size, "JS-Called malloc");
79 }
80 void __attribute__((export_name("TS_free"))) TS_free(uint32_t ptr) {
81         FREE((void*)ptr);
82 }
83
84 jstring __attribute__((export_name("TS_get_ldk_c_bindings_version"))) TS_get_ldk_c_bindings_version() {
85         const char *res = check_get_ldk_bindings_version();
86         if (res == NULL) return NULL;
87         return str_ref_to_ts(res, strlen(res));
88 }
89 jstring __attribute__((export_name("TS_get_ldk_version"))) get_ldk_version() {
90         const char *res = check_get_ldk_version();
91         if (res == NULL) return NULL;
92         return str_ref_to_ts(res, strlen(res));
93 }
94 #include "version.c"
95 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
96
97 static inline void* untag_ptr(uint64_t ptr) {
98         if (ptr < 4096) return (void*)ptr;
99         if (sizeof(void*) == 4) {
100                 // For 32-bit systems, store pointers as 64-bit ints and use the 31st bit
101                 return (void*)(uintptr_t)ptr;
102         } else {
103                 // For 64-bit systems, assume the top byte is used for tagging, then
104                 // use bit 9 ^ bit 10.
105                 uint64_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
106                 uintptr_t p = (ptr & ~(1ULL << 55)) | (tenth_bit << 55);
107 #ifdef LDK_DEBUG_BUILD
108                 // On debug builds we also use the 11th bit as a debug flag
109                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
110                 CHECK(tenth_bit != eleventh_bit);
111                 p ^= 1ULL << 53;
112 #endif
113                 return (void*)p;
114         }
115 }
116 static inline bool ptr_is_owned(uint64_t ptr) {
117         if(ptr < 4096) return true;
118         if (sizeof(void*) == 4) {
119                 return ptr & (1ULL << 32);
120         } else {
121                 uintptr_t ninth_bit = (((uintptr_t)ptr) & (1ULL << 55)) >> 55;
122                 uintptr_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
123 #ifdef LDK_DEBUG_BUILD
124                 // On debug builds we also use the 11th bit as a debug flag
125                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
126                 CHECK(tenth_bit != eleventh_bit);
127 #endif
128                 return (ninth_bit ^ tenth_bit) ? true : false;
129         }
130 }
131 static inline uint64_t tag_ptr(const void* ptr, bool is_owned) {
132         if ((uintptr_t)ptr < 4096) return (uint64_t)ptr;
133         if (sizeof(void*) == 4) {
134                 return (((uint64_t)ptr) | ((is_owned ? 1ULL : 0) << 32));
135         } else {
136                 CHECK(sizeof(uintptr_t) == 8);
137                 uintptr_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
138                 uintptr_t t = (((uintptr_t)ptr) | (((is_owned ? 1ULL : 0ULL) ^ tenth_bit) << 55));
139 #ifdef LDK_DEBUG_BUILD
140                 uintptr_t ninth_bit = (((uintptr_t)ptr) & (1ULL << 55)) >> 55;
141                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
142                 CHECK(ninth_bit == tenth_bit);
143                 CHECK(ninth_bit == eleventh_bit);
144                 t ^= 1ULL << 53;
145 #endif
146                 CHECK(ptr_is_owned(t) == is_owned);
147                 CHECK(untag_ptr(t) == ptr);
148                 return t;
149         }
150 }
151
152 static inline LDKAccessError LDKAccessError_from_js(int32_t ord) {
153         switch (ord) {
154                 case 0: return LDKAccessError_UnknownChain;
155                 case 1: return LDKAccessError_UnknownTx;
156         }
157         abort();
158 }
159 static inline int32_t LDKAccessError_to_js(LDKAccessError val) {
160         switch (val) {
161                 case LDKAccessError_UnknownChain: return 0;
162                 case LDKAccessError_UnknownTx: return 1;
163                 default: abort();
164         }
165 }
166 static inline LDKCOption_NoneZ LDKCOption_NoneZ_from_js(int32_t ord) {
167         switch (ord) {
168                 case 0: return LDKCOption_NoneZ_Some;
169                 case 1: return LDKCOption_NoneZ_None;
170         }
171         abort();
172 }
173 static inline int32_t LDKCOption_NoneZ_to_js(LDKCOption_NoneZ val) {
174         switch (val) {
175                 case LDKCOption_NoneZ_Some: return 0;
176                 case LDKCOption_NoneZ_None: return 1;
177                 default: abort();
178         }
179 }
180 static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_js(int32_t ord) {
181         switch (ord) {
182                 case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure;
183                 case 1: return LDKChannelMonitorUpdateErr_PermanentFailure;
184         }
185         abort();
186 }
187 static inline int32_t LDKChannelMonitorUpdateErr_to_js(LDKChannelMonitorUpdateErr val) {
188         switch (val) {
189                 case LDKChannelMonitorUpdateErr_TemporaryFailure: return 0;
190                 case LDKChannelMonitorUpdateErr_PermanentFailure: return 1;
191                 default: abort();
192         }
193 }
194 static inline LDKConfirmationTarget LDKConfirmationTarget_from_js(int32_t ord) {
195         switch (ord) {
196                 case 0: return LDKConfirmationTarget_Background;
197                 case 1: return LDKConfirmationTarget_Normal;
198                 case 2: return LDKConfirmationTarget_HighPriority;
199         }
200         abort();
201 }
202 static inline int32_t LDKConfirmationTarget_to_js(LDKConfirmationTarget val) {
203         switch (val) {
204                 case LDKConfirmationTarget_Background: return 0;
205                 case LDKConfirmationTarget_Normal: return 1;
206                 case LDKConfirmationTarget_HighPriority: return 2;
207                 default: abort();
208         }
209 }
210 static inline LDKCreationError LDKCreationError_from_js(int32_t ord) {
211         switch (ord) {
212                 case 0: return LDKCreationError_DescriptionTooLong;
213                 case 1: return LDKCreationError_RouteTooLong;
214                 case 2: return LDKCreationError_TimestampOutOfBounds;
215                 case 3: return LDKCreationError_InvalidAmount;
216                 case 4: return LDKCreationError_MissingRouteHints;
217         }
218         abort();
219 }
220 static inline int32_t LDKCreationError_to_js(LDKCreationError val) {
221         switch (val) {
222                 case LDKCreationError_DescriptionTooLong: return 0;
223                 case LDKCreationError_RouteTooLong: return 1;
224                 case LDKCreationError_TimestampOutOfBounds: return 2;
225                 case LDKCreationError_InvalidAmount: return 3;
226                 case LDKCreationError_MissingRouteHints: return 4;
227                 default: abort();
228         }
229 }
230 static inline LDKCurrency LDKCurrency_from_js(int32_t ord) {
231         switch (ord) {
232                 case 0: return LDKCurrency_Bitcoin;
233                 case 1: return LDKCurrency_BitcoinTestnet;
234                 case 2: return LDKCurrency_Regtest;
235                 case 3: return LDKCurrency_Simnet;
236                 case 4: return LDKCurrency_Signet;
237         }
238         abort();
239 }
240 static inline int32_t LDKCurrency_to_js(LDKCurrency val) {
241         switch (val) {
242                 case LDKCurrency_Bitcoin: return 0;
243                 case LDKCurrency_BitcoinTestnet: return 1;
244                 case LDKCurrency_Regtest: return 2;
245                 case LDKCurrency_Simnet: return 3;
246                 case LDKCurrency_Signet: return 4;
247                 default: abort();
248         }
249 }
250 static inline LDKIOError LDKIOError_from_js(int32_t ord) {
251         switch (ord) {
252                 case 0: return LDKIOError_NotFound;
253                 case 1: return LDKIOError_PermissionDenied;
254                 case 2: return LDKIOError_ConnectionRefused;
255                 case 3: return LDKIOError_ConnectionReset;
256                 case 4: return LDKIOError_ConnectionAborted;
257                 case 5: return LDKIOError_NotConnected;
258                 case 6: return LDKIOError_AddrInUse;
259                 case 7: return LDKIOError_AddrNotAvailable;
260                 case 8: return LDKIOError_BrokenPipe;
261                 case 9: return LDKIOError_AlreadyExists;
262                 case 10: return LDKIOError_WouldBlock;
263                 case 11: return LDKIOError_InvalidInput;
264                 case 12: return LDKIOError_InvalidData;
265                 case 13: return LDKIOError_TimedOut;
266                 case 14: return LDKIOError_WriteZero;
267                 case 15: return LDKIOError_Interrupted;
268                 case 16: return LDKIOError_Other;
269                 case 17: return LDKIOError_UnexpectedEof;
270         }
271         abort();
272 }
273 static inline int32_t LDKIOError_to_js(LDKIOError val) {
274         switch (val) {
275                 case LDKIOError_NotFound: return 0;
276                 case LDKIOError_PermissionDenied: return 1;
277                 case LDKIOError_ConnectionRefused: return 2;
278                 case LDKIOError_ConnectionReset: return 3;
279                 case LDKIOError_ConnectionAborted: return 4;
280                 case LDKIOError_NotConnected: return 5;
281                 case LDKIOError_AddrInUse: return 6;
282                 case LDKIOError_AddrNotAvailable: return 7;
283                 case LDKIOError_BrokenPipe: return 8;
284                 case LDKIOError_AlreadyExists: return 9;
285                 case LDKIOError_WouldBlock: return 10;
286                 case LDKIOError_InvalidInput: return 11;
287                 case LDKIOError_InvalidData: return 12;
288                 case LDKIOError_TimedOut: return 13;
289                 case LDKIOError_WriteZero: return 14;
290                 case LDKIOError_Interrupted: return 15;
291                 case LDKIOError_Other: return 16;
292                 case LDKIOError_UnexpectedEof: return 17;
293                 default: abort();
294         }
295 }
296 static inline LDKLevel LDKLevel_from_js(int32_t ord) {
297         switch (ord) {
298                 case 0: return LDKLevel_Gossip;
299                 case 1: return LDKLevel_Trace;
300                 case 2: return LDKLevel_Debug;
301                 case 3: return LDKLevel_Info;
302                 case 4: return LDKLevel_Warn;
303                 case 5: return LDKLevel_Error;
304         }
305         abort();
306 }
307 static inline int32_t LDKLevel_to_js(LDKLevel val) {
308         switch (val) {
309                 case LDKLevel_Gossip: return 0;
310                 case LDKLevel_Trace: return 1;
311                 case LDKLevel_Debug: return 2;
312                 case LDKLevel_Info: return 3;
313                 case LDKLevel_Warn: return 4;
314                 case LDKLevel_Error: return 5;
315                 default: abort();
316         }
317 }
318 static inline LDKNetwork LDKNetwork_from_js(int32_t ord) {
319         switch (ord) {
320                 case 0: return LDKNetwork_Bitcoin;
321                 case 1: return LDKNetwork_Testnet;
322                 case 2: return LDKNetwork_Regtest;
323                 case 3: return LDKNetwork_Signet;
324         }
325         abort();
326 }
327 static inline int32_t LDKNetwork_to_js(LDKNetwork val) {
328         switch (val) {
329                 case LDKNetwork_Bitcoin: return 0;
330                 case LDKNetwork_Testnet: return 1;
331                 case LDKNetwork_Regtest: return 2;
332                 case LDKNetwork_Signet: return 3;
333                 default: abort();
334         }
335 }
336 static inline LDKRecipient LDKRecipient_from_js(int32_t ord) {
337         switch (ord) {
338                 case 0: return LDKRecipient_Node;
339                 case 1: return LDKRecipient_PhantomNode;
340         }
341         abort();
342 }
343 static inline int32_t LDKRecipient_to_js(LDKRecipient val) {
344         switch (val) {
345                 case LDKRecipient_Node: return 0;
346                 case LDKRecipient_PhantomNode: return 1;
347                 default: abort();
348         }
349 }
350 static inline LDKSecp256k1Error LDKSecp256k1Error_from_js(int32_t ord) {
351         switch (ord) {
352                 case 0: return LDKSecp256k1Error_IncorrectSignature;
353                 case 1: return LDKSecp256k1Error_InvalidMessage;
354                 case 2: return LDKSecp256k1Error_InvalidPublicKey;
355                 case 3: return LDKSecp256k1Error_InvalidSignature;
356                 case 4: return LDKSecp256k1Error_InvalidSecretKey;
357                 case 5: return LDKSecp256k1Error_InvalidSharedSecret;
358                 case 6: return LDKSecp256k1Error_InvalidRecoveryId;
359                 case 7: return LDKSecp256k1Error_InvalidTweak;
360                 case 8: return LDKSecp256k1Error_NotEnoughMemory;
361                 case 9: return LDKSecp256k1Error_InvalidPublicKeySum;
362                 case 10: return LDKSecp256k1Error_InvalidParityValue;
363         }
364         abort();
365 }
366 static inline int32_t LDKSecp256k1Error_to_js(LDKSecp256k1Error val) {
367         switch (val) {
368                 case LDKSecp256k1Error_IncorrectSignature: return 0;
369                 case LDKSecp256k1Error_InvalidMessage: return 1;
370                 case LDKSecp256k1Error_InvalidPublicKey: return 2;
371                 case LDKSecp256k1Error_InvalidSignature: return 3;
372                 case LDKSecp256k1Error_InvalidSecretKey: return 4;
373                 case LDKSecp256k1Error_InvalidSharedSecret: return 5;
374                 case LDKSecp256k1Error_InvalidRecoveryId: return 6;
375                 case LDKSecp256k1Error_InvalidTweak: return 7;
376                 case LDKSecp256k1Error_NotEnoughMemory: return 8;
377                 case LDKSecp256k1Error_InvalidPublicKeySum: return 9;
378                 case LDKSecp256k1Error_InvalidParityValue: return 10;
379                 default: abort();
380         }
381 }
382 static inline LDKSemanticError LDKSemanticError_from_js(int32_t ord) {
383         switch (ord) {
384                 case 0: return LDKSemanticError_NoPaymentHash;
385                 case 1: return LDKSemanticError_MultiplePaymentHashes;
386                 case 2: return LDKSemanticError_NoDescription;
387                 case 3: return LDKSemanticError_MultipleDescriptions;
388                 case 4: return LDKSemanticError_NoPaymentSecret;
389                 case 5: return LDKSemanticError_MultiplePaymentSecrets;
390                 case 6: return LDKSemanticError_InvalidFeatures;
391                 case 7: return LDKSemanticError_InvalidRecoveryId;
392                 case 8: return LDKSemanticError_InvalidSignature;
393                 case 9: return LDKSemanticError_ImpreciseAmount;
394         }
395         abort();
396 }
397 static inline int32_t LDKSemanticError_to_js(LDKSemanticError val) {
398         switch (val) {
399                 case LDKSemanticError_NoPaymentHash: return 0;
400                 case LDKSemanticError_MultiplePaymentHashes: return 1;
401                 case LDKSemanticError_NoDescription: return 2;
402                 case LDKSemanticError_MultipleDescriptions: return 3;
403                 case LDKSemanticError_NoPaymentSecret: return 4;
404                 case LDKSemanticError_MultiplePaymentSecrets: return 5;
405                 case LDKSemanticError_InvalidFeatures: return 6;
406                 case LDKSemanticError_InvalidRecoveryId: return 7;
407                 case LDKSemanticError_InvalidSignature: return 8;
408                 case LDKSemanticError_ImpreciseAmount: return 9;
409                 default: abort();
410         }
411 }
412 static inline LDKSiPrefix LDKSiPrefix_from_js(int32_t ord) {
413         switch (ord) {
414                 case 0: return LDKSiPrefix_Milli;
415                 case 1: return LDKSiPrefix_Micro;
416                 case 2: return LDKSiPrefix_Nano;
417                 case 3: return LDKSiPrefix_Pico;
418         }
419         abort();
420 }
421 static inline int32_t LDKSiPrefix_to_js(LDKSiPrefix val) {
422         switch (val) {
423                 case LDKSiPrefix_Milli: return 0;
424                 case LDKSiPrefix_Micro: return 1;
425                 case LDKSiPrefix_Nano: return 2;
426                 case LDKSiPrefix_Pico: return 3;
427                 default: abort();
428         }
429 }
430 struct LDKThirtyTwoBytes BigEndianScalar_get_bytes (struct LDKBigEndianScalar* thing) {
431         LDKThirtyTwoBytes ret = { .data = *thing->big_endian_bytes };
432         return ret;
433 }
434 int8_tArray  __attribute__((export_name("TS_BigEndianScalar_get_bytes"))) TS_BigEndianScalar_get_bytes(uint64_t thing) {
435         LDKBigEndianScalar* thing_conv = (LDKBigEndianScalar*)untag_ptr(thing);
436         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
437         memcpy(ret_arr->elems, BigEndianScalar_get_bytes(thing_conv).data, 32);
438         return ret_arr;
439 }
440
441 static void BigEndianScalar_free (struct LDKBigEndianScalar thing) {}
442 void  __attribute__((export_name("TS_BigEndianScalar_free"))) TS_BigEndianScalar_free(uint64_t thing) {
443         if (!ptr_is_owned(thing)) return;
444         void* thing_ptr = untag_ptr(thing);
445         CHECK_ACCESS(thing_ptr);
446         LDKBigEndianScalar thing_conv = *(LDKBigEndianScalar*)(thing_ptr);
447         FREE(untag_ptr(thing));
448         BigEndianScalar_free(thing_conv);
449 }
450
451 uint32_t __attribute__((export_name("TS_LDKBech32Error_ty_from_ptr"))) TS_LDKBech32Error_ty_from_ptr(uint64_t ptr) {
452         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
453         switch(obj->tag) {
454                 case LDKBech32Error_MissingSeparator: return 0;
455                 case LDKBech32Error_InvalidChecksum: return 1;
456                 case LDKBech32Error_InvalidLength: return 2;
457                 case LDKBech32Error_InvalidChar: return 3;
458                 case LDKBech32Error_InvalidData: return 4;
459                 case LDKBech32Error_InvalidPadding: return 5;
460                 case LDKBech32Error_MixedCase: return 6;
461                 default: abort();
462         }
463 }
464 int32_t __attribute__((export_name("TS_LDKBech32Error_InvalidChar_get_invalid_char"))) TS_LDKBech32Error_InvalidChar_get_invalid_char(uint64_t ptr) {
465         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
466         assert(obj->tag == LDKBech32Error_InvalidChar);
467                         int32_t invalid_char_conv = obj->invalid_char;
468         return invalid_char_conv;
469 }
470 int8_t __attribute__((export_name("TS_LDKBech32Error_InvalidData_get_invalid_data"))) TS_LDKBech32Error_InvalidData_get_invalid_data(uint64_t ptr) {
471         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
472         assert(obj->tag == LDKBech32Error_InvalidData);
473                         int8_t invalid_data_conv = obj->invalid_data;
474         return invalid_data_conv;
475 }
476 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
477         LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
478         memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
479         return ret;
480 }
481 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) {
482         LDKTxOut* thing_conv = (LDKTxOut*)untag_ptr(thing);
483         LDKCVec_u8Z ret_var = TxOut_get_script_pubkey(thing_conv);
484         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
485         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
486         CVec_u8Z_free(ret_var);
487         return ret_arr;
488 }
489
490 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) {
491         LDKTxOut* thing_conv = (LDKTxOut*)untag_ptr(thing);
492         int64_t ret_conv = TxOut_get_value(thing_conv);
493         return ret_conv;
494 }
495
496 static inline struct LDKBlindedRoute CResult_BlindedRouteNoneZ_get_ok(LDKCResult_BlindedRouteNoneZ *NONNULL_PTR owner){
497         LDKBlindedRoute ret = *owner->contents.result;
498         ret.is_owned = false;
499         return ret;
500 }
501 uint64_t  __attribute__((export_name("TS_CResult_BlindedRouteNoneZ_get_ok"))) TS_CResult_BlindedRouteNoneZ_get_ok(uint64_t owner) {
502         LDKCResult_BlindedRouteNoneZ* owner_conv = (LDKCResult_BlindedRouteNoneZ*)untag_ptr(owner);
503         LDKBlindedRoute ret_var = CResult_BlindedRouteNoneZ_get_ok(owner_conv);
504         uint64_t ret_ref = 0;
505         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
506         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
507         return ret_ref;
508 }
509
510 static inline void CResult_BlindedRouteNoneZ_get_err(LDKCResult_BlindedRouteNoneZ *NONNULL_PTR owner){
511 CHECK(!owner->result_ok);
512         return *owner->contents.err;
513 }
514 void  __attribute__((export_name("TS_CResult_BlindedRouteNoneZ_get_err"))) TS_CResult_BlindedRouteNoneZ_get_err(uint64_t owner) {
515         LDKCResult_BlindedRouteNoneZ* owner_conv = (LDKCResult_BlindedRouteNoneZ*)untag_ptr(owner);
516         CResult_BlindedRouteNoneZ_get_err(owner_conv);
517 }
518
519 static inline struct LDKBlindedRoute CResult_BlindedRouteDecodeErrorZ_get_ok(LDKCResult_BlindedRouteDecodeErrorZ *NONNULL_PTR owner){
520         LDKBlindedRoute ret = *owner->contents.result;
521         ret.is_owned = false;
522         return ret;
523 }
524 uint64_t  __attribute__((export_name("TS_CResult_BlindedRouteDecodeErrorZ_get_ok"))) TS_CResult_BlindedRouteDecodeErrorZ_get_ok(uint64_t owner) {
525         LDKCResult_BlindedRouteDecodeErrorZ* owner_conv = (LDKCResult_BlindedRouteDecodeErrorZ*)untag_ptr(owner);
526         LDKBlindedRoute ret_var = CResult_BlindedRouteDecodeErrorZ_get_ok(owner_conv);
527         uint64_t ret_ref = 0;
528         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
529         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
530         return ret_ref;
531 }
532
533 static inline struct LDKDecodeError CResult_BlindedRouteDecodeErrorZ_get_err(LDKCResult_BlindedRouteDecodeErrorZ *NONNULL_PTR owner){
534         LDKDecodeError ret = *owner->contents.err;
535         ret.is_owned = false;
536         return ret;
537 }
538 uint64_t  __attribute__((export_name("TS_CResult_BlindedRouteDecodeErrorZ_get_err"))) TS_CResult_BlindedRouteDecodeErrorZ_get_err(uint64_t owner) {
539         LDKCResult_BlindedRouteDecodeErrorZ* owner_conv = (LDKCResult_BlindedRouteDecodeErrorZ*)untag_ptr(owner);
540         LDKDecodeError ret_var = CResult_BlindedRouteDecodeErrorZ_get_err(owner_conv);
541         uint64_t ret_ref = 0;
542         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
543         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
544         return ret_ref;
545 }
546
547 static inline struct LDKBlindedHop CResult_BlindedHopDecodeErrorZ_get_ok(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
548         LDKBlindedHop ret = *owner->contents.result;
549         ret.is_owned = false;
550         return ret;
551 }
552 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_get_ok"))) TS_CResult_BlindedHopDecodeErrorZ_get_ok(uint64_t owner) {
553         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
554         LDKBlindedHop ret_var = CResult_BlindedHopDecodeErrorZ_get_ok(owner_conv);
555         uint64_t ret_ref = 0;
556         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
557         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
558         return ret_ref;
559 }
560
561 static inline struct LDKDecodeError CResult_BlindedHopDecodeErrorZ_get_err(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
562         LDKDecodeError ret = *owner->contents.err;
563         ret.is_owned = false;
564         return ret;
565 }
566 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_get_err"))) TS_CResult_BlindedHopDecodeErrorZ_get_err(uint64_t owner) {
567         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
568         LDKDecodeError ret_var = CResult_BlindedHopDecodeErrorZ_get_err(owner_conv);
569         uint64_t ret_ref = 0;
570         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
571         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
572         return ret_ref;
573 }
574
575 static inline void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
576 CHECK(owner->result_ok);
577         return *owner->contents.result;
578 }
579 void  __attribute__((export_name("TS_CResult_NoneNoneZ_get_ok"))) TS_CResult_NoneNoneZ_get_ok(uint64_t owner) {
580         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
581         CResult_NoneNoneZ_get_ok(owner_conv);
582 }
583
584 static inline void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
585 CHECK(!owner->result_ok);
586         return *owner->contents.err;
587 }
588 void  __attribute__((export_name("TS_CResult_NoneNoneZ_get_err"))) TS_CResult_NoneNoneZ_get_err(uint64_t owner) {
589         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
590         CResult_NoneNoneZ_get_err(owner_conv);
591 }
592
593 static inline struct LDKCounterpartyCommitmentSecrets CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
594         LDKCounterpartyCommitmentSecrets ret = *owner->contents.result;
595         ret.is_owned = false;
596         return ret;
597 }
598 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(uint64_t owner) {
599         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
600         LDKCounterpartyCommitmentSecrets ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(owner_conv);
601         uint64_t ret_ref = 0;
602         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
603         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
604         return ret_ref;
605 }
606
607 static inline struct LDKDecodeError CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
608         LDKDecodeError ret = *owner->contents.err;
609         ret.is_owned = false;
610         return ret;
611 }
612 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(uint64_t owner) {
613         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
614         LDKDecodeError ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(owner_conv);
615         uint64_t ret_ref = 0;
616         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
617         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
618         return ret_ref;
619 }
620
621 static inline struct LDKSecretKey CResult_SecretKeyErrorZ_get_ok(LDKCResult_SecretKeyErrorZ *NONNULL_PTR owner){
622 CHECK(owner->result_ok);
623         return *owner->contents.result;
624 }
625 int8_tArray  __attribute__((export_name("TS_CResult_SecretKeyErrorZ_get_ok"))) TS_CResult_SecretKeyErrorZ_get_ok(uint64_t owner) {
626         LDKCResult_SecretKeyErrorZ* owner_conv = (LDKCResult_SecretKeyErrorZ*)untag_ptr(owner);
627         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
628         memcpy(ret_arr->elems, CResult_SecretKeyErrorZ_get_ok(owner_conv).bytes, 32);
629         return ret_arr;
630 }
631
632 static inline enum LDKSecp256k1Error CResult_SecretKeyErrorZ_get_err(LDKCResult_SecretKeyErrorZ *NONNULL_PTR owner){
633 CHECK(!owner->result_ok);
634         return *owner->contents.err;
635 }
636 uint32_t  __attribute__((export_name("TS_CResult_SecretKeyErrorZ_get_err"))) TS_CResult_SecretKeyErrorZ_get_err(uint64_t owner) {
637         LDKCResult_SecretKeyErrorZ* owner_conv = (LDKCResult_SecretKeyErrorZ*)untag_ptr(owner);
638         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_SecretKeyErrorZ_get_err(owner_conv));
639         return ret_conv;
640 }
641
642 static inline struct LDKPublicKey CResult_PublicKeyErrorZ_get_ok(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
643 CHECK(owner->result_ok);
644         return *owner->contents.result;
645 }
646 int8_tArray  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_get_ok"))) TS_CResult_PublicKeyErrorZ_get_ok(uint64_t owner) {
647         LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(owner);
648         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
649         memcpy(ret_arr->elems, CResult_PublicKeyErrorZ_get_ok(owner_conv).compressed_form, 33);
650         return ret_arr;
651 }
652
653 static inline enum LDKSecp256k1Error CResult_PublicKeyErrorZ_get_err(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
654 CHECK(!owner->result_ok);
655         return *owner->contents.err;
656 }
657 uint32_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_get_err"))) TS_CResult_PublicKeyErrorZ_get_err(uint64_t owner) {
658         LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(owner);
659         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_PublicKeyErrorZ_get_err(owner_conv));
660         return ret_conv;
661 }
662
663 static inline struct LDKTxCreationKeys CResult_TxCreationKeysDecodeErrorZ_get_ok(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
664         LDKTxCreationKeys ret = *owner->contents.result;
665         ret.is_owned = false;
666         return ret;
667 }
668 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_get_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_get_ok(uint64_t owner) {
669         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
670         LDKTxCreationKeys ret_var = CResult_TxCreationKeysDecodeErrorZ_get_ok(owner_conv);
671         uint64_t ret_ref = 0;
672         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
673         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
674         return ret_ref;
675 }
676
677 static inline struct LDKDecodeError CResult_TxCreationKeysDecodeErrorZ_get_err(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
678         LDKDecodeError ret = *owner->contents.err;
679         ret.is_owned = false;
680         return ret;
681 }
682 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_get_err"))) TS_CResult_TxCreationKeysDecodeErrorZ_get_err(uint64_t owner) {
683         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
684         LDKDecodeError ret_var = CResult_TxCreationKeysDecodeErrorZ_get_err(owner_conv);
685         uint64_t ret_ref = 0;
686         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
687         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
688         return ret_ref;
689 }
690
691 static inline struct LDKChannelPublicKeys CResult_ChannelPublicKeysDecodeErrorZ_get_ok(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
692         LDKChannelPublicKeys ret = *owner->contents.result;
693         ret.is_owned = false;
694         return ret;
695 }
696 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_get_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_get_ok(uint64_t owner) {
697         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
698         LDKChannelPublicKeys ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_ok(owner_conv);
699         uint64_t ret_ref = 0;
700         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
701         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
702         return ret_ref;
703 }
704
705 static inline struct LDKDecodeError CResult_ChannelPublicKeysDecodeErrorZ_get_err(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
706         LDKDecodeError ret = *owner->contents.err;
707         ret.is_owned = false;
708         return ret;
709 }
710 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_get_err"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_get_err(uint64_t owner) {
711         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
712         LDKDecodeError ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_err(owner_conv);
713         uint64_t ret_ref = 0;
714         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
715         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
716         return ret_ref;
717 }
718
719 static inline struct LDKTxCreationKeys CResult_TxCreationKeysErrorZ_get_ok(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR owner){
720         LDKTxCreationKeys ret = *owner->contents.result;
721         ret.is_owned = false;
722         return ret;
723 }
724 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_get_ok"))) TS_CResult_TxCreationKeysErrorZ_get_ok(uint64_t owner) {
725         LDKCResult_TxCreationKeysErrorZ* owner_conv = (LDKCResult_TxCreationKeysErrorZ*)untag_ptr(owner);
726         LDKTxCreationKeys ret_var = CResult_TxCreationKeysErrorZ_get_ok(owner_conv);
727         uint64_t ret_ref = 0;
728         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
729         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
730         return ret_ref;
731 }
732
733 static inline enum LDKSecp256k1Error CResult_TxCreationKeysErrorZ_get_err(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR owner){
734 CHECK(!owner->result_ok);
735         return *owner->contents.err;
736 }
737 uint32_t  __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_get_err"))) TS_CResult_TxCreationKeysErrorZ_get_err(uint64_t owner) {
738         LDKCResult_TxCreationKeysErrorZ* owner_conv = (LDKCResult_TxCreationKeysErrorZ*)untag_ptr(owner);
739         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_TxCreationKeysErrorZ_get_err(owner_conv));
740         return ret_conv;
741 }
742
743 uint32_t __attribute__((export_name("TS_LDKCOption_u32Z_ty_from_ptr"))) TS_LDKCOption_u32Z_ty_from_ptr(uint64_t ptr) {
744         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
745         switch(obj->tag) {
746                 case LDKCOption_u32Z_Some: return 0;
747                 case LDKCOption_u32Z_None: return 1;
748                 default: abort();
749         }
750 }
751 int32_t __attribute__((export_name("TS_LDKCOption_u32Z_Some_get_some"))) TS_LDKCOption_u32Z_Some_get_some(uint64_t ptr) {
752         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
753         assert(obj->tag == LDKCOption_u32Z_Some);
754                         int32_t some_conv = obj->some;
755         return some_conv;
756 }
757 static inline struct LDKHTLCOutputInCommitment CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
758         LDKHTLCOutputInCommitment ret = *owner->contents.result;
759         ret.is_owned = false;
760         return ret;
761 }
762 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(uint64_t owner) {
763         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
764         LDKHTLCOutputInCommitment ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(owner_conv);
765         uint64_t ret_ref = 0;
766         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
767         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
768         return ret_ref;
769 }
770
771 static inline struct LDKDecodeError CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
772         LDKDecodeError ret = *owner->contents.err;
773         ret.is_owned = false;
774         return ret;
775 }
776 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(uint64_t owner) {
777         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
778         LDKDecodeError ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(owner_conv);
779         uint64_t ret_ref = 0;
780         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
781         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
782         return ret_ref;
783 }
784
785 static inline struct LDKCounterpartyChannelTransactionParameters CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
786         LDKCounterpartyChannelTransactionParameters ret = *owner->contents.result;
787         ret.is_owned = false;
788         return ret;
789 }
790 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(uint64_t owner) {
791         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
792         LDKCounterpartyChannelTransactionParameters ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
793         uint64_t ret_ref = 0;
794         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
795         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
796         return ret_ref;
797 }
798
799 static inline struct LDKDecodeError CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
800         LDKDecodeError ret = *owner->contents.err;
801         ret.is_owned = false;
802         return ret;
803 }
804 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(uint64_t owner) {
805         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
806         LDKDecodeError ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
807         uint64_t ret_ref = 0;
808         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
809         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
810         return ret_ref;
811 }
812
813 static inline struct LDKChannelTransactionParameters CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
814         LDKChannelTransactionParameters ret = *owner->contents.result;
815         ret.is_owned = false;
816         return ret;
817 }
818 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(uint64_t owner) {
819         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
820         LDKChannelTransactionParameters ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
821         uint64_t ret_ref = 0;
822         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
823         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
824         return ret_ref;
825 }
826
827 static inline struct LDKDecodeError CResult_ChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
828         LDKDecodeError ret = *owner->contents.err;
829         ret.is_owned = false;
830         return ret;
831 }
832 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_err"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_err(uint64_t owner) {
833         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
834         LDKDecodeError ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
835         uint64_t ret_ref = 0;
836         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
837         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
838         return ret_ref;
839 }
840
841 static inline struct LDKHolderCommitmentTransaction CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
842         LDKHolderCommitmentTransaction ret = *owner->contents.result;
843         ret.is_owned = false;
844         return ret;
845 }
846 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
847         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
848         LDKHolderCommitmentTransaction ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
849         uint64_t ret_ref = 0;
850         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
851         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
852         return ret_ref;
853 }
854
855 static inline struct LDKDecodeError CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
856         LDKDecodeError ret = *owner->contents.err;
857         ret.is_owned = false;
858         return ret;
859 }
860 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
861         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
862         LDKDecodeError ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
863         uint64_t ret_ref = 0;
864         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
865         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
866         return ret_ref;
867 }
868
869 static inline struct LDKBuiltCommitmentTransaction CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
870         LDKBuiltCommitmentTransaction ret = *owner->contents.result;
871         ret.is_owned = false;
872         return ret;
873 }
874 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
875         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
876         LDKBuiltCommitmentTransaction ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
877         uint64_t ret_ref = 0;
878         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
879         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
880         return ret_ref;
881 }
882
883 static inline struct LDKDecodeError CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
884         LDKDecodeError ret = *owner->contents.err;
885         ret.is_owned = false;
886         return ret;
887 }
888 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
889         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
890         LDKDecodeError ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
891         uint64_t ret_ref = 0;
892         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
893         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
894         return ret_ref;
895 }
896
897 static inline struct LDKTrustedClosingTransaction CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
898         LDKTrustedClosingTransaction ret = *owner->contents.result;
899         ret.is_owned = false;
900         return ret;
901 }
902 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_get_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_get_ok(uint64_t owner) {
903         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
904         LDKTrustedClosingTransaction ret_var = CResult_TrustedClosingTransactionNoneZ_get_ok(owner_conv);
905         uint64_t ret_ref = 0;
906         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
907         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
908         return ret_ref;
909 }
910
911 static inline void CResult_TrustedClosingTransactionNoneZ_get_err(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
912 CHECK(!owner->result_ok);
913         return *owner->contents.err;
914 }
915 void  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_get_err"))) TS_CResult_TrustedClosingTransactionNoneZ_get_err(uint64_t owner) {
916         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
917         CResult_TrustedClosingTransactionNoneZ_get_err(owner_conv);
918 }
919
920 static inline struct LDKCommitmentTransaction CResult_CommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
921         LDKCommitmentTransaction ret = *owner->contents.result;
922         ret.is_owned = false;
923         return ret;
924 }
925 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
926         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
927         LDKCommitmentTransaction ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
928         uint64_t ret_ref = 0;
929         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
930         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
931         return ret_ref;
932 }
933
934 static inline struct LDKDecodeError CResult_CommitmentTransactionDecodeErrorZ_get_err(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
935         LDKDecodeError ret = *owner->contents.err;
936         ret.is_owned = false;
937         return ret;
938 }
939 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_CommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
940         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
941         LDKDecodeError ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_err(owner_conv);
942         uint64_t ret_ref = 0;
943         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
944         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
945         return ret_ref;
946 }
947
948 static inline struct LDKTrustedCommitmentTransaction CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
949         LDKTrustedCommitmentTransaction ret = *owner->contents.result;
950         ret.is_owned = false;
951         return ret;
952 }
953 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_get_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_get_ok(uint64_t owner) {
954         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
955         LDKTrustedCommitmentTransaction ret_var = CResult_TrustedCommitmentTransactionNoneZ_get_ok(owner_conv);
956         uint64_t ret_ref = 0;
957         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
958         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
959         return ret_ref;
960 }
961
962 static inline void CResult_TrustedCommitmentTransactionNoneZ_get_err(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
963 CHECK(!owner->result_ok);
964         return *owner->contents.err;
965 }
966 void  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_get_err"))) TS_CResult_TrustedCommitmentTransactionNoneZ_get_err(uint64_t owner) {
967         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
968         CResult_TrustedCommitmentTransactionNoneZ_get_err(owner_conv);
969 }
970
971 static inline struct LDKCVec_SignatureZ CResult_CVec_SignatureZNoneZ_get_ok(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
972 CHECK(owner->result_ok);
973         return *owner->contents.result;
974 }
975 ptrArray  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_get_ok"))) TS_CResult_CVec_SignatureZNoneZ_get_ok(uint64_t owner) {
976         LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(owner);
977         LDKCVec_SignatureZ ret_var = CResult_CVec_SignatureZNoneZ_get_ok(owner_conv);
978         ptrArray ret_arr = NULL;
979         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
980         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
981         for (size_t m = 0; m < ret_var.datalen; m++) {
982                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
983                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
984                 ret_arr_ptr[m] = ret_conv_12_arr;
985         }
986         
987         return ret_arr;
988 }
989
990 static inline void CResult_CVec_SignatureZNoneZ_get_err(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
991 CHECK(!owner->result_ok);
992         return *owner->contents.err;
993 }
994 void  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_get_err"))) TS_CResult_CVec_SignatureZNoneZ_get_err(uint64_t owner) {
995         LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(owner);
996         CResult_CVec_SignatureZNoneZ_get_err(owner_conv);
997 }
998
999 static inline struct LDKShutdownScript CResult_ShutdownScriptDecodeErrorZ_get_ok(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
1000         LDKShutdownScript ret = *owner->contents.result;
1001         ret.is_owned = false;
1002         return ret;
1003 }
1004 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_get_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_get_ok(uint64_t owner) {
1005         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
1006         LDKShutdownScript ret_var = CResult_ShutdownScriptDecodeErrorZ_get_ok(owner_conv);
1007         uint64_t ret_ref = 0;
1008         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1009         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1010         return ret_ref;
1011 }
1012
1013 static inline struct LDKDecodeError CResult_ShutdownScriptDecodeErrorZ_get_err(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
1014         LDKDecodeError ret = *owner->contents.err;
1015         ret.is_owned = false;
1016         return ret;
1017 }
1018 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_get_err"))) TS_CResult_ShutdownScriptDecodeErrorZ_get_err(uint64_t owner) {
1019         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
1020         LDKDecodeError ret_var = CResult_ShutdownScriptDecodeErrorZ_get_err(owner_conv);
1021         uint64_t ret_ref = 0;
1022         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1023         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1024         return ret_ref;
1025 }
1026
1027 static inline struct LDKShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
1028         LDKShutdownScript ret = *owner->contents.result;
1029         ret.is_owned = false;
1030         return ret;
1031 }
1032 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(uint64_t owner) {
1033         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
1034         LDKShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(owner_conv);
1035         uint64_t ret_ref = 0;
1036         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1037         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1038         return ret_ref;
1039 }
1040
1041 static inline struct LDKInvalidShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
1042         LDKInvalidShutdownScript ret = *owner->contents.err;
1043         ret.is_owned = false;
1044         return ret;
1045 }
1046 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_err"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(uint64_t owner) {
1047         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
1048         LDKInvalidShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(owner_conv);
1049         uint64_t ret_ref = 0;
1050         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1051         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1052         return ret_ref;
1053 }
1054
1055 static inline struct LDKRouteHop CResult_RouteHopDecodeErrorZ_get_ok(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
1056         LDKRouteHop ret = *owner->contents.result;
1057         ret.is_owned = false;
1058         return ret;
1059 }
1060 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_get_ok"))) TS_CResult_RouteHopDecodeErrorZ_get_ok(uint64_t owner) {
1061         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
1062         LDKRouteHop ret_var = CResult_RouteHopDecodeErrorZ_get_ok(owner_conv);
1063         uint64_t ret_ref = 0;
1064         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1065         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1066         return ret_ref;
1067 }
1068
1069 static inline struct LDKDecodeError CResult_RouteHopDecodeErrorZ_get_err(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
1070         LDKDecodeError ret = *owner->contents.err;
1071         ret.is_owned = false;
1072         return ret;
1073 }
1074 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_get_err"))) TS_CResult_RouteHopDecodeErrorZ_get_err(uint64_t owner) {
1075         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
1076         LDKDecodeError ret_var = CResult_RouteHopDecodeErrorZ_get_err(owner_conv);
1077         uint64_t ret_ref = 0;
1078         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1079         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1080         return ret_ref;
1081 }
1082
1083 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
1084         LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
1085         for (size_t i = 0; i < ret.datalen; i++) {
1086                 ret.data[i] = RouteHop_clone(&orig->data[i]);
1087         }
1088         return ret;
1089 }
1090 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
1091         LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
1092         for (size_t i = 0; i < ret.datalen; i++) {
1093                 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
1094         }
1095         return ret;
1096 }
1097 static inline struct LDKRoute CResult_RouteDecodeErrorZ_get_ok(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
1098         LDKRoute ret = *owner->contents.result;
1099         ret.is_owned = false;
1100         return ret;
1101 }
1102 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_get_ok"))) TS_CResult_RouteDecodeErrorZ_get_ok(uint64_t owner) {
1103         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
1104         LDKRoute ret_var = CResult_RouteDecodeErrorZ_get_ok(owner_conv);
1105         uint64_t ret_ref = 0;
1106         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1107         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1108         return ret_ref;
1109 }
1110
1111 static inline struct LDKDecodeError CResult_RouteDecodeErrorZ_get_err(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
1112         LDKDecodeError ret = *owner->contents.err;
1113         ret.is_owned = false;
1114         return ret;
1115 }
1116 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_get_err"))) TS_CResult_RouteDecodeErrorZ_get_err(uint64_t owner) {
1117         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
1118         LDKDecodeError ret_var = CResult_RouteDecodeErrorZ_get_err(owner_conv);
1119         uint64_t ret_ref = 0;
1120         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1121         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1122         return ret_ref;
1123 }
1124
1125 static inline struct LDKRouteParameters CResult_RouteParametersDecodeErrorZ_get_ok(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
1126         LDKRouteParameters ret = *owner->contents.result;
1127         ret.is_owned = false;
1128         return ret;
1129 }
1130 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_get_ok"))) TS_CResult_RouteParametersDecodeErrorZ_get_ok(uint64_t owner) {
1131         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
1132         LDKRouteParameters ret_var = CResult_RouteParametersDecodeErrorZ_get_ok(owner_conv);
1133         uint64_t ret_ref = 0;
1134         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1135         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1136         return ret_ref;
1137 }
1138
1139 static inline struct LDKDecodeError CResult_RouteParametersDecodeErrorZ_get_err(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
1140         LDKDecodeError ret = *owner->contents.err;
1141         ret.is_owned = false;
1142         return ret;
1143 }
1144 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_get_err"))) TS_CResult_RouteParametersDecodeErrorZ_get_err(uint64_t owner) {
1145         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
1146         LDKDecodeError ret_var = CResult_RouteParametersDecodeErrorZ_get_err(owner_conv);
1147         uint64_t ret_ref = 0;
1148         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1149         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1150         return ret_ref;
1151 }
1152
1153 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
1154         LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
1155         for (size_t i = 0; i < ret.datalen; i++) {
1156                 ret.data[i] = RouteHint_clone(&orig->data[i]);
1157         }
1158         return ret;
1159 }
1160 uint32_t __attribute__((export_name("TS_LDKCOption_u64Z_ty_from_ptr"))) TS_LDKCOption_u64Z_ty_from_ptr(uint64_t ptr) {
1161         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
1162         switch(obj->tag) {
1163                 case LDKCOption_u64Z_Some: return 0;
1164                 case LDKCOption_u64Z_None: return 1;
1165                 default: abort();
1166         }
1167 }
1168 int64_t __attribute__((export_name("TS_LDKCOption_u64Z_Some_get_some"))) TS_LDKCOption_u64Z_Some_get_some(uint64_t ptr) {
1169         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
1170         assert(obj->tag == LDKCOption_u64Z_Some);
1171                         int64_t some_conv = obj->some;
1172         return some_conv;
1173 }
1174 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
1175         LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
1176         memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
1177         return ret;
1178 }
1179 static inline struct LDKPaymentParameters CResult_PaymentParametersDecodeErrorZ_get_ok(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
1180         LDKPaymentParameters ret = *owner->contents.result;
1181         ret.is_owned = false;
1182         return ret;
1183 }
1184 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_get_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_get_ok(uint64_t owner) {
1185         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
1186         LDKPaymentParameters ret_var = CResult_PaymentParametersDecodeErrorZ_get_ok(owner_conv);
1187         uint64_t ret_ref = 0;
1188         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1189         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1190         return ret_ref;
1191 }
1192
1193 static inline struct LDKDecodeError CResult_PaymentParametersDecodeErrorZ_get_err(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
1194         LDKDecodeError ret = *owner->contents.err;
1195         ret.is_owned = false;
1196         return ret;
1197 }
1198 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_get_err"))) TS_CResult_PaymentParametersDecodeErrorZ_get_err(uint64_t owner) {
1199         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
1200         LDKDecodeError ret_var = CResult_PaymentParametersDecodeErrorZ_get_err(owner_conv);
1201         uint64_t ret_ref = 0;
1202         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1203         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1204         return ret_ref;
1205 }
1206
1207 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
1208         LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
1209         for (size_t i = 0; i < ret.datalen; i++) {
1210                 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
1211         }
1212         return ret;
1213 }
1214 static inline struct LDKRouteHint CResult_RouteHintDecodeErrorZ_get_ok(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
1215         LDKRouteHint ret = *owner->contents.result;
1216         ret.is_owned = false;
1217         return ret;
1218 }
1219 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_get_ok"))) TS_CResult_RouteHintDecodeErrorZ_get_ok(uint64_t owner) {
1220         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
1221         LDKRouteHint ret_var = CResult_RouteHintDecodeErrorZ_get_ok(owner_conv);
1222         uint64_t ret_ref = 0;
1223         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1224         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1225         return ret_ref;
1226 }
1227
1228 static inline struct LDKDecodeError CResult_RouteHintDecodeErrorZ_get_err(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
1229         LDKDecodeError ret = *owner->contents.err;
1230         ret.is_owned = false;
1231         return ret;
1232 }
1233 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_get_err"))) TS_CResult_RouteHintDecodeErrorZ_get_err(uint64_t owner) {
1234         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
1235         LDKDecodeError ret_var = CResult_RouteHintDecodeErrorZ_get_err(owner_conv);
1236         uint64_t ret_ref = 0;
1237         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1238         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1239         return ret_ref;
1240 }
1241
1242 static inline struct LDKRouteHintHop CResult_RouteHintHopDecodeErrorZ_get_ok(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
1243         LDKRouteHintHop ret = *owner->contents.result;
1244         ret.is_owned = false;
1245         return ret;
1246 }
1247 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_get_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_get_ok(uint64_t owner) {
1248         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
1249         LDKRouteHintHop ret_var = CResult_RouteHintHopDecodeErrorZ_get_ok(owner_conv);
1250         uint64_t ret_ref = 0;
1251         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1252         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1253         return ret_ref;
1254 }
1255
1256 static inline struct LDKDecodeError CResult_RouteHintHopDecodeErrorZ_get_err(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
1257         LDKDecodeError ret = *owner->contents.err;
1258         ret.is_owned = false;
1259         return ret;
1260 }
1261 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_get_err"))) TS_CResult_RouteHintHopDecodeErrorZ_get_err(uint64_t owner) {
1262         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
1263         LDKDecodeError ret_var = CResult_RouteHintHopDecodeErrorZ_get_err(owner_conv);
1264         uint64_t ret_ref = 0;
1265         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1266         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1267         return ret_ref;
1268 }
1269
1270 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
1271         LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
1272         for (size_t i = 0; i < ret.datalen; i++) {
1273                 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
1274         }
1275         return ret;
1276 }
1277 static inline struct LDKRoute CResult_RouteLightningErrorZ_get_ok(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
1278         LDKRoute ret = *owner->contents.result;
1279         ret.is_owned = false;
1280         return ret;
1281 }
1282 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_get_ok"))) TS_CResult_RouteLightningErrorZ_get_ok(uint64_t owner) {
1283         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
1284         LDKRoute ret_var = CResult_RouteLightningErrorZ_get_ok(owner_conv);
1285         uint64_t ret_ref = 0;
1286         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1287         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1288         return ret_ref;
1289 }
1290
1291 static inline struct LDKLightningError CResult_RouteLightningErrorZ_get_err(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
1292         LDKLightningError ret = *owner->contents.err;
1293         ret.is_owned = false;
1294         return ret;
1295 }
1296 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_get_err"))) TS_CResult_RouteLightningErrorZ_get_err(uint64_t owner) {
1297         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
1298         LDKLightningError ret_var = CResult_RouteLightningErrorZ_get_err(owner_conv);
1299         uint64_t ret_ref = 0;
1300         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1301         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1302         return ret_ref;
1303 }
1304
1305 uint32_t __attribute__((export_name("TS_LDKPaymentPurpose_ty_from_ptr"))) TS_LDKPaymentPurpose_ty_from_ptr(uint64_t ptr) {
1306         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
1307         switch(obj->tag) {
1308                 case LDKPaymentPurpose_InvoicePayment: return 0;
1309                 case LDKPaymentPurpose_SpontaneousPayment: return 1;
1310                 default: abort();
1311         }
1312 }
1313 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_InvoicePayment_get_payment_preimage"))) TS_LDKPaymentPurpose_InvoicePayment_get_payment_preimage(uint64_t ptr) {
1314         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
1315         assert(obj->tag == LDKPaymentPurpose_InvoicePayment);
1316                         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
1317                         memcpy(payment_preimage_arr->elems, obj->invoice_payment.payment_preimage.data, 32);
1318         return payment_preimage_arr;
1319 }
1320 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_InvoicePayment_get_payment_secret"))) TS_LDKPaymentPurpose_InvoicePayment_get_payment_secret(uint64_t ptr) {
1321         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
1322         assert(obj->tag == LDKPaymentPurpose_InvoicePayment);
1323                         int8_tArray payment_secret_arr = init_int8_tArray(32, __LINE__);
1324                         memcpy(payment_secret_arr->elems, obj->invoice_payment.payment_secret.data, 32);
1325         return payment_secret_arr;
1326 }
1327 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_SpontaneousPayment_get_spontaneous_payment"))) TS_LDKPaymentPurpose_SpontaneousPayment_get_spontaneous_payment(uint64_t ptr) {
1328         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
1329         assert(obj->tag == LDKPaymentPurpose_SpontaneousPayment);
1330                         int8_tArray spontaneous_payment_arr = init_int8_tArray(32, __LINE__);
1331                         memcpy(spontaneous_payment_arr->elems, obj->spontaneous_payment.data, 32);
1332         return spontaneous_payment_arr;
1333 }
1334 static inline struct LDKPaymentPurpose CResult_PaymentPurposeDecodeErrorZ_get_ok(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
1335 CHECK(owner->result_ok);
1336         return PaymentPurpose_clone(&*owner->contents.result);
1337 }
1338 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_get_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_get_ok(uint64_t owner) {
1339         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
1340         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
1341         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_ok(owner_conv);
1342         uint64_t ret_ref = tag_ptr(ret_copy, true);
1343         return ret_ref;
1344 }
1345
1346 static inline struct LDKDecodeError CResult_PaymentPurposeDecodeErrorZ_get_err(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
1347         LDKDecodeError ret = *owner->contents.err;
1348         ret.is_owned = false;
1349         return ret;
1350 }
1351 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_get_err"))) TS_CResult_PaymentPurposeDecodeErrorZ_get_err(uint64_t owner) {
1352         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
1353         LDKDecodeError ret_var = CResult_PaymentPurposeDecodeErrorZ_get_err(owner_conv);
1354         uint64_t ret_ref = 0;
1355         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1356         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1357         return ret_ref;
1358 }
1359
1360 uint32_t __attribute__((export_name("TS_LDKClosureReason_ty_from_ptr"))) TS_LDKClosureReason_ty_from_ptr(uint64_t ptr) {
1361         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
1362         switch(obj->tag) {
1363                 case LDKClosureReason_CounterpartyForceClosed: return 0;
1364                 case LDKClosureReason_HolderForceClosed: return 1;
1365                 case LDKClosureReason_CooperativeClosure: return 2;
1366                 case LDKClosureReason_CommitmentTxConfirmed: return 3;
1367                 case LDKClosureReason_FundingTimedOut: return 4;
1368                 case LDKClosureReason_ProcessingError: return 5;
1369                 case LDKClosureReason_DisconnectedPeer: return 6;
1370                 case LDKClosureReason_OutdatedChannelManager: return 7;
1371                 default: abort();
1372         }
1373 }
1374 jstring __attribute__((export_name("TS_LDKClosureReason_CounterpartyForceClosed_get_peer_msg"))) TS_LDKClosureReason_CounterpartyForceClosed_get_peer_msg(uint64_t ptr) {
1375         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
1376         assert(obj->tag == LDKClosureReason_CounterpartyForceClosed);
1377                         LDKStr peer_msg_str = obj->counterparty_force_closed.peer_msg;
1378                         jstring peer_msg_conv = str_ref_to_ts(peer_msg_str.chars, peer_msg_str.len);
1379         return peer_msg_conv;
1380 }
1381 jstring __attribute__((export_name("TS_LDKClosureReason_ProcessingError_get_err"))) TS_LDKClosureReason_ProcessingError_get_err(uint64_t ptr) {
1382         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
1383         assert(obj->tag == LDKClosureReason_ProcessingError);
1384                         LDKStr err_str = obj->processing_error.err;
1385                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
1386         return err_conv;
1387 }
1388 uint32_t __attribute__((export_name("TS_LDKCOption_ClosureReasonZ_ty_from_ptr"))) TS_LDKCOption_ClosureReasonZ_ty_from_ptr(uint64_t ptr) {
1389         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
1390         switch(obj->tag) {
1391                 case LDKCOption_ClosureReasonZ_Some: return 0;
1392                 case LDKCOption_ClosureReasonZ_None: return 1;
1393                 default: abort();
1394         }
1395 }
1396 uint64_t __attribute__((export_name("TS_LDKCOption_ClosureReasonZ_Some_get_some"))) TS_LDKCOption_ClosureReasonZ_Some_get_some(uint64_t ptr) {
1397         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
1398         assert(obj->tag == LDKCOption_ClosureReasonZ_Some);
1399                         uint64_t some_ref = tag_ptr(&obj->some, false);
1400         return some_ref;
1401 }
1402 static inline struct LDKCOption_ClosureReasonZ CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
1403 CHECK(owner->result_ok);
1404         return COption_ClosureReasonZ_clone(&*owner->contents.result);
1405 }
1406 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(uint64_t owner) {
1407         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
1408         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
1409         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(owner_conv);
1410         uint64_t ret_ref = tag_ptr(ret_copy, true);
1411         return ret_ref;
1412 }
1413
1414 static inline struct LDKDecodeError CResult_COption_ClosureReasonZDecodeErrorZ_get_err(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
1415         LDKDecodeError ret = *owner->contents.err;
1416         ret.is_owned = false;
1417         return ret;
1418 }
1419 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_err"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_err(uint64_t owner) {
1420         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
1421         LDKDecodeError ret_var = CResult_COption_ClosureReasonZDecodeErrorZ_get_err(owner_conv);
1422         uint64_t ret_ref = 0;
1423         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1424         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1425         return ret_ref;
1426 }
1427
1428 uint32_t __attribute__((export_name("TS_LDKHTLCDestination_ty_from_ptr"))) TS_LDKHTLCDestination_ty_from_ptr(uint64_t ptr) {
1429         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
1430         switch(obj->tag) {
1431                 case LDKHTLCDestination_NextHopChannel: return 0;
1432                 case LDKHTLCDestination_UnknownNextHop: return 1;
1433                 case LDKHTLCDestination_FailedPayment: return 2;
1434                 default: abort();
1435         }
1436 }
1437 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_NextHopChannel_get_node_id"))) TS_LDKHTLCDestination_NextHopChannel_get_node_id(uint64_t ptr) {
1438         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
1439         assert(obj->tag == LDKHTLCDestination_NextHopChannel);
1440                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
1441                         memcpy(node_id_arr->elems, obj->next_hop_channel.node_id.compressed_form, 33);
1442         return node_id_arr;
1443 }
1444 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_NextHopChannel_get_channel_id"))) TS_LDKHTLCDestination_NextHopChannel_get_channel_id(uint64_t ptr) {
1445         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
1446         assert(obj->tag == LDKHTLCDestination_NextHopChannel);
1447                         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
1448                         memcpy(channel_id_arr->elems, obj->next_hop_channel.channel_id.data, 32);
1449         return channel_id_arr;
1450 }
1451 int64_t __attribute__((export_name("TS_LDKHTLCDestination_UnknownNextHop_get_requested_forward_scid"))) TS_LDKHTLCDestination_UnknownNextHop_get_requested_forward_scid(uint64_t ptr) {
1452         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
1453         assert(obj->tag == LDKHTLCDestination_UnknownNextHop);
1454                         int64_t requested_forward_scid_conv = obj->unknown_next_hop.requested_forward_scid;
1455         return requested_forward_scid_conv;
1456 }
1457 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_FailedPayment_get_payment_hash"))) TS_LDKHTLCDestination_FailedPayment_get_payment_hash(uint64_t ptr) {
1458         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
1459         assert(obj->tag == LDKHTLCDestination_FailedPayment);
1460                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1461                         memcpy(payment_hash_arr->elems, obj->failed_payment.payment_hash.data, 32);
1462         return payment_hash_arr;
1463 }
1464 uint32_t __attribute__((export_name("TS_LDKCOption_HTLCDestinationZ_ty_from_ptr"))) TS_LDKCOption_HTLCDestinationZ_ty_from_ptr(uint64_t ptr) {
1465         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
1466         switch(obj->tag) {
1467                 case LDKCOption_HTLCDestinationZ_Some: return 0;
1468                 case LDKCOption_HTLCDestinationZ_None: return 1;
1469                 default: abort();
1470         }
1471 }
1472 uint64_t __attribute__((export_name("TS_LDKCOption_HTLCDestinationZ_Some_get_some"))) TS_LDKCOption_HTLCDestinationZ_Some_get_some(uint64_t ptr) {
1473         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
1474         assert(obj->tag == LDKCOption_HTLCDestinationZ_Some);
1475                         uint64_t some_ref = tag_ptr(&obj->some, false);
1476         return some_ref;
1477 }
1478 static inline struct LDKCOption_HTLCDestinationZ CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
1479 CHECK(owner->result_ok);
1480         return COption_HTLCDestinationZ_clone(&*owner->contents.result);
1481 }
1482 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(uint64_t owner) {
1483         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
1484         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
1485         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(owner_conv);
1486         uint64_t ret_ref = tag_ptr(ret_copy, true);
1487         return ret_ref;
1488 }
1489
1490 static inline struct LDKDecodeError CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
1491         LDKDecodeError ret = *owner->contents.err;
1492         ret.is_owned = false;
1493         return ret;
1494 }
1495 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_err"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(uint64_t owner) {
1496         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
1497         LDKDecodeError ret_var = CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(owner_conv);
1498         uint64_t ret_ref = 0;
1499         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1500         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1501         return ret_ref;
1502 }
1503
1504 uint32_t __attribute__((export_name("TS_LDKNetworkUpdate_ty_from_ptr"))) TS_LDKNetworkUpdate_ty_from_ptr(uint64_t ptr) {
1505         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
1506         switch(obj->tag) {
1507                 case LDKNetworkUpdate_ChannelUpdateMessage: return 0;
1508                 case LDKNetworkUpdate_ChannelFailure: return 1;
1509                 case LDKNetworkUpdate_NodeFailure: return 2;
1510                 default: abort();
1511         }
1512 }
1513 uint64_t __attribute__((export_name("TS_LDKNetworkUpdate_ChannelUpdateMessage_get_msg"))) TS_LDKNetworkUpdate_ChannelUpdateMessage_get_msg(uint64_t ptr) {
1514         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
1515         assert(obj->tag == LDKNetworkUpdate_ChannelUpdateMessage);
1516                         LDKChannelUpdate msg_var = obj->channel_update_message.msg;
1517                         uint64_t msg_ref = 0;
1518                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1519                         msg_ref = tag_ptr(msg_var.inner, false);
1520         return msg_ref;
1521 }
1522 int64_t __attribute__((export_name("TS_LDKNetworkUpdate_ChannelFailure_get_short_channel_id"))) TS_LDKNetworkUpdate_ChannelFailure_get_short_channel_id(uint64_t ptr) {
1523         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
1524         assert(obj->tag == LDKNetworkUpdate_ChannelFailure);
1525                         int64_t short_channel_id_conv = obj->channel_failure.short_channel_id;
1526         return short_channel_id_conv;
1527 }
1528 jboolean __attribute__((export_name("TS_LDKNetworkUpdate_ChannelFailure_get_is_permanent"))) TS_LDKNetworkUpdate_ChannelFailure_get_is_permanent(uint64_t ptr) {
1529         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
1530         assert(obj->tag == LDKNetworkUpdate_ChannelFailure);
1531                         jboolean is_permanent_conv = obj->channel_failure.is_permanent;
1532         return is_permanent_conv;
1533 }
1534 int8_tArray __attribute__((export_name("TS_LDKNetworkUpdate_NodeFailure_get_node_id"))) TS_LDKNetworkUpdate_NodeFailure_get_node_id(uint64_t ptr) {
1535         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
1536         assert(obj->tag == LDKNetworkUpdate_NodeFailure);
1537                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
1538                         memcpy(node_id_arr->elems, obj->node_failure.node_id.compressed_form, 33);
1539         return node_id_arr;
1540 }
1541 jboolean __attribute__((export_name("TS_LDKNetworkUpdate_NodeFailure_get_is_permanent"))) TS_LDKNetworkUpdate_NodeFailure_get_is_permanent(uint64_t ptr) {
1542         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
1543         assert(obj->tag == LDKNetworkUpdate_NodeFailure);
1544                         jboolean is_permanent_conv = obj->node_failure.is_permanent;
1545         return is_permanent_conv;
1546 }
1547 uint32_t __attribute__((export_name("TS_LDKCOption_NetworkUpdateZ_ty_from_ptr"))) TS_LDKCOption_NetworkUpdateZ_ty_from_ptr(uint64_t ptr) {
1548         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
1549         switch(obj->tag) {
1550                 case LDKCOption_NetworkUpdateZ_Some: return 0;
1551                 case LDKCOption_NetworkUpdateZ_None: return 1;
1552                 default: abort();
1553         }
1554 }
1555 uint64_t __attribute__((export_name("TS_LDKCOption_NetworkUpdateZ_Some_get_some"))) TS_LDKCOption_NetworkUpdateZ_Some_get_some(uint64_t ptr) {
1556         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
1557         assert(obj->tag == LDKCOption_NetworkUpdateZ_Some);
1558                         uint64_t some_ref = tag_ptr(&obj->some, false);
1559         return some_ref;
1560 }
1561 uint32_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_ty_from_ptr"))) TS_LDKSpendableOutputDescriptor_ty_from_ptr(uint64_t ptr) {
1562         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1563         switch(obj->tag) {
1564                 case LDKSpendableOutputDescriptor_StaticOutput: return 0;
1565                 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: return 1;
1566                 case LDKSpendableOutputDescriptor_StaticPaymentOutput: return 2;
1567                 default: abort();
1568         }
1569 }
1570 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_outpoint"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_outpoint(uint64_t ptr) {
1571         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1572         assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1573                         LDKOutPoint outpoint_var = obj->static_output.outpoint;
1574                         uint64_t outpoint_ref = 0;
1575                         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
1576                         outpoint_ref = tag_ptr(outpoint_var.inner, false);
1577         return outpoint_ref;
1578 }
1579 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_output"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_output(uint64_t ptr) {
1580         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1581         assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1582                         LDKTxOut* output_ref = &obj->static_output.output;
1583         return tag_ptr(output_ref, false);
1584 }
1585 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_DelayedPaymentOutput_get_delayed_payment_output"))) TS_LDKSpendableOutputDescriptor_DelayedPaymentOutput_get_delayed_payment_output(uint64_t ptr) {
1586         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1587         assert(obj->tag == LDKSpendableOutputDescriptor_DelayedPaymentOutput);
1588                         LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
1589                         uint64_t delayed_payment_output_ref = 0;
1590                         CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_output_var);
1591                         delayed_payment_output_ref = tag_ptr(delayed_payment_output_var.inner, false);
1592         return delayed_payment_output_ref;
1593 }
1594 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticPaymentOutput_get_static_payment_output"))) TS_LDKSpendableOutputDescriptor_StaticPaymentOutput_get_static_payment_output(uint64_t ptr) {
1595         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1596         assert(obj->tag == LDKSpendableOutputDescriptor_StaticPaymentOutput);
1597                         LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
1598                         uint64_t static_payment_output_ref = 0;
1599                         CHECK_INNER_FIELD_ACCESS_OR_NULL(static_payment_output_var);
1600                         static_payment_output_ref = tag_ptr(static_payment_output_var.inner, false);
1601         return static_payment_output_ref;
1602 }
1603 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1604         LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1605         for (size_t i = 0; i < ret.datalen; i++) {
1606                 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1607         }
1608         return ret;
1609 }
1610 uint32_t __attribute__((export_name("TS_LDKEvent_ty_from_ptr"))) TS_LDKEvent_ty_from_ptr(uint64_t ptr) {
1611         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1612         switch(obj->tag) {
1613                 case LDKEvent_FundingGenerationReady: return 0;
1614                 case LDKEvent_PaymentReceived: return 1;
1615                 case LDKEvent_PaymentClaimed: return 2;
1616                 case LDKEvent_PaymentSent: return 3;
1617                 case LDKEvent_PaymentFailed: return 4;
1618                 case LDKEvent_PaymentPathSuccessful: return 5;
1619                 case LDKEvent_PaymentPathFailed: return 6;
1620                 case LDKEvent_ProbeSuccessful: return 7;
1621                 case LDKEvent_ProbeFailed: return 8;
1622                 case LDKEvent_PendingHTLCsForwardable: return 9;
1623                 case LDKEvent_SpendableOutputs: return 10;
1624                 case LDKEvent_PaymentForwarded: return 11;
1625                 case LDKEvent_ChannelClosed: return 12;
1626                 case LDKEvent_DiscardFunding: return 13;
1627                 case LDKEvent_OpenChannelRequest: return 14;
1628                 case LDKEvent_HTLCHandlingFailed: return 15;
1629                 default: abort();
1630         }
1631 }
1632 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_temporary_channel_id"))) TS_LDKEvent_FundingGenerationReady_get_temporary_channel_id(uint64_t ptr) {
1633         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1634         assert(obj->tag == LDKEvent_FundingGenerationReady);
1635                         int8_tArray temporary_channel_id_arr = init_int8_tArray(32, __LINE__);
1636                         memcpy(temporary_channel_id_arr->elems, obj->funding_generation_ready.temporary_channel_id.data, 32);
1637         return temporary_channel_id_arr;
1638 }
1639 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_counterparty_node_id"))) TS_LDKEvent_FundingGenerationReady_get_counterparty_node_id(uint64_t ptr) {
1640         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1641         assert(obj->tag == LDKEvent_FundingGenerationReady);
1642                         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
1643                         memcpy(counterparty_node_id_arr->elems, obj->funding_generation_ready.counterparty_node_id.compressed_form, 33);
1644         return counterparty_node_id_arr;
1645 }
1646 int64_t __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_channel_value_satoshis"))) TS_LDKEvent_FundingGenerationReady_get_channel_value_satoshis(uint64_t ptr) {
1647         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1648         assert(obj->tag == LDKEvent_FundingGenerationReady);
1649                         int64_t channel_value_satoshis_conv = obj->funding_generation_ready.channel_value_satoshis;
1650         return channel_value_satoshis_conv;
1651 }
1652 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_output_script"))) TS_LDKEvent_FundingGenerationReady_get_output_script(uint64_t ptr) {
1653         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1654         assert(obj->tag == LDKEvent_FundingGenerationReady);
1655                         LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
1656                         int8_tArray output_script_arr = init_int8_tArray(output_script_var.datalen, __LINE__);
1657                         memcpy(output_script_arr->elems, output_script_var.data, output_script_var.datalen);
1658         return output_script_arr;
1659 }
1660 int64_t __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_user_channel_id"))) TS_LDKEvent_FundingGenerationReady_get_user_channel_id(uint64_t ptr) {
1661         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1662         assert(obj->tag == LDKEvent_FundingGenerationReady);
1663                         int64_t user_channel_id_conv = obj->funding_generation_ready.user_channel_id;
1664         return user_channel_id_conv;
1665 }
1666 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentReceived_get_payment_hash"))) TS_LDKEvent_PaymentReceived_get_payment_hash(uint64_t ptr) {
1667         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1668         assert(obj->tag == LDKEvent_PaymentReceived);
1669                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1670                         memcpy(payment_hash_arr->elems, obj->payment_received.payment_hash.data, 32);
1671         return payment_hash_arr;
1672 }
1673 int64_t __attribute__((export_name("TS_LDKEvent_PaymentReceived_get_amount_msat"))) TS_LDKEvent_PaymentReceived_get_amount_msat(uint64_t ptr) {
1674         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1675         assert(obj->tag == LDKEvent_PaymentReceived);
1676                         int64_t amount_msat_conv = obj->payment_received.amount_msat;
1677         return amount_msat_conv;
1678 }
1679 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentReceived_get_purpose"))) TS_LDKEvent_PaymentReceived_get_purpose(uint64_t ptr) {
1680         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1681         assert(obj->tag == LDKEvent_PaymentReceived);
1682                         uint64_t purpose_ref = tag_ptr(&obj->payment_received.purpose, false);
1683         return purpose_ref;
1684 }
1685 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_payment_hash"))) TS_LDKEvent_PaymentClaimed_get_payment_hash(uint64_t ptr) {
1686         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1687         assert(obj->tag == LDKEvent_PaymentClaimed);
1688                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1689                         memcpy(payment_hash_arr->elems, obj->payment_claimed.payment_hash.data, 32);
1690         return payment_hash_arr;
1691 }
1692 int64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_amount_msat"))) TS_LDKEvent_PaymentClaimed_get_amount_msat(uint64_t ptr) {
1693         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1694         assert(obj->tag == LDKEvent_PaymentClaimed);
1695                         int64_t amount_msat_conv = obj->payment_claimed.amount_msat;
1696         return amount_msat_conv;
1697 }
1698 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_purpose"))) TS_LDKEvent_PaymentClaimed_get_purpose(uint64_t ptr) {
1699         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1700         assert(obj->tag == LDKEvent_PaymentClaimed);
1701                         uint64_t purpose_ref = tag_ptr(&obj->payment_claimed.purpose, false);
1702         return purpose_ref;
1703 }
1704 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_id"))) TS_LDKEvent_PaymentSent_get_payment_id(uint64_t ptr) {
1705         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1706         assert(obj->tag == LDKEvent_PaymentSent);
1707                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1708                         memcpy(payment_id_arr->elems, obj->payment_sent.payment_id.data, 32);
1709         return payment_id_arr;
1710 }
1711 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_preimage"))) TS_LDKEvent_PaymentSent_get_payment_preimage(uint64_t ptr) {
1712         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1713         assert(obj->tag == LDKEvent_PaymentSent);
1714                         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
1715                         memcpy(payment_preimage_arr->elems, obj->payment_sent.payment_preimage.data, 32);
1716         return payment_preimage_arr;
1717 }
1718 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_hash"))) TS_LDKEvent_PaymentSent_get_payment_hash(uint64_t ptr) {
1719         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1720         assert(obj->tag == LDKEvent_PaymentSent);
1721                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1722                         memcpy(payment_hash_arr->elems, obj->payment_sent.payment_hash.data, 32);
1723         return payment_hash_arr;
1724 }
1725 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentSent_get_fee_paid_msat"))) TS_LDKEvent_PaymentSent_get_fee_paid_msat(uint64_t ptr) {
1726         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1727         assert(obj->tag == LDKEvent_PaymentSent);
1728                         uint64_t fee_paid_msat_ref = tag_ptr(&obj->payment_sent.fee_paid_msat, false);
1729         return fee_paid_msat_ref;
1730 }
1731 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_payment_id"))) TS_LDKEvent_PaymentFailed_get_payment_id(uint64_t ptr) {
1732         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1733         assert(obj->tag == LDKEvent_PaymentFailed);
1734                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1735                         memcpy(payment_id_arr->elems, obj->payment_failed.payment_id.data, 32);
1736         return payment_id_arr;
1737 }
1738 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_payment_hash"))) TS_LDKEvent_PaymentFailed_get_payment_hash(uint64_t ptr) {
1739         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1740         assert(obj->tag == LDKEvent_PaymentFailed);
1741                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1742                         memcpy(payment_hash_arr->elems, obj->payment_failed.payment_hash.data, 32);
1743         return payment_hash_arr;
1744 }
1745 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_payment_id"))) TS_LDKEvent_PaymentPathSuccessful_get_payment_id(uint64_t ptr) {
1746         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1747         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
1748                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1749                         memcpy(payment_id_arr->elems, obj->payment_path_successful.payment_id.data, 32);
1750         return payment_id_arr;
1751 }
1752 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_payment_hash"))) TS_LDKEvent_PaymentPathSuccessful_get_payment_hash(uint64_t ptr) {
1753         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1754         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
1755                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1756                         memcpy(payment_hash_arr->elems, obj->payment_path_successful.payment_hash.data, 32);
1757         return payment_hash_arr;
1758 }
1759 uint64_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_path"))) TS_LDKEvent_PaymentPathSuccessful_get_path(uint64_t ptr) {
1760         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1761         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
1762                         LDKCVec_RouteHopZ path_var = obj->payment_path_successful.path;
1763                         uint64_tArray path_arr = NULL;
1764                         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
1765                         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
1766                         for (size_t k = 0; k < path_var.datalen; k++) {
1767                                 LDKRouteHop path_conv_10_var = path_var.data[k];
1768                                 uint64_t path_conv_10_ref = 0;
1769                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1770                                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, false);
1771                                 path_arr_ptr[k] = path_conv_10_ref;
1772                         }
1773                         
1774         return path_arr;
1775 }
1776 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_id"))) TS_LDKEvent_PaymentPathFailed_get_payment_id(uint64_t ptr) {
1777         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1778         assert(obj->tag == LDKEvent_PaymentPathFailed);
1779                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1780                         memcpy(payment_id_arr->elems, obj->payment_path_failed.payment_id.data, 32);
1781         return payment_id_arr;
1782 }
1783 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_hash"))) TS_LDKEvent_PaymentPathFailed_get_payment_hash(uint64_t ptr) {
1784         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1785         assert(obj->tag == LDKEvent_PaymentPathFailed);
1786                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1787                         memcpy(payment_hash_arr->elems, obj->payment_path_failed.payment_hash.data, 32);
1788         return payment_hash_arr;
1789 }
1790 jboolean __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_failed_permanently"))) TS_LDKEvent_PaymentPathFailed_get_payment_failed_permanently(uint64_t ptr) {
1791         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1792         assert(obj->tag == LDKEvent_PaymentPathFailed);
1793                         jboolean payment_failed_permanently_conv = obj->payment_path_failed.payment_failed_permanently;
1794         return payment_failed_permanently_conv;
1795 }
1796 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_network_update"))) TS_LDKEvent_PaymentPathFailed_get_network_update(uint64_t ptr) {
1797         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1798         assert(obj->tag == LDKEvent_PaymentPathFailed);
1799                         uint64_t network_update_ref = tag_ptr(&obj->payment_path_failed.network_update, false);
1800         return network_update_ref;
1801 }
1802 jboolean __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_all_paths_failed"))) TS_LDKEvent_PaymentPathFailed_get_all_paths_failed(uint64_t ptr) {
1803         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1804         assert(obj->tag == LDKEvent_PaymentPathFailed);
1805                         jboolean all_paths_failed_conv = obj->payment_path_failed.all_paths_failed;
1806         return all_paths_failed_conv;
1807 }
1808 uint64_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_path"))) TS_LDKEvent_PaymentPathFailed_get_path(uint64_t ptr) {
1809         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1810         assert(obj->tag == LDKEvent_PaymentPathFailed);
1811                         LDKCVec_RouteHopZ path_var = obj->payment_path_failed.path;
1812                         uint64_tArray path_arr = NULL;
1813                         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
1814                         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
1815                         for (size_t k = 0; k < path_var.datalen; k++) {
1816                                 LDKRouteHop path_conv_10_var = path_var.data[k];
1817                                 uint64_t path_conv_10_ref = 0;
1818                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1819                                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, false);
1820                                 path_arr_ptr[k] = path_conv_10_ref;
1821                         }
1822                         
1823         return path_arr;
1824 }
1825 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_short_channel_id"))) TS_LDKEvent_PaymentPathFailed_get_short_channel_id(uint64_t ptr) {
1826         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1827         assert(obj->tag == LDKEvent_PaymentPathFailed);
1828                         uint64_t short_channel_id_ref = tag_ptr(&obj->payment_path_failed.short_channel_id, false);
1829         return short_channel_id_ref;
1830 }
1831 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_retry"))) TS_LDKEvent_PaymentPathFailed_get_retry(uint64_t ptr) {
1832         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1833         assert(obj->tag == LDKEvent_PaymentPathFailed);
1834                         LDKRouteParameters retry_var = obj->payment_path_failed.retry;
1835                         uint64_t retry_ref = 0;
1836                         CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_var);
1837                         retry_ref = tag_ptr(retry_var.inner, false);
1838         return retry_ref;
1839 }
1840 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_payment_id"))) TS_LDKEvent_ProbeSuccessful_get_payment_id(uint64_t ptr) {
1841         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1842         assert(obj->tag == LDKEvent_ProbeSuccessful);
1843                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1844                         memcpy(payment_id_arr->elems, obj->probe_successful.payment_id.data, 32);
1845         return payment_id_arr;
1846 }
1847 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_payment_hash"))) TS_LDKEvent_ProbeSuccessful_get_payment_hash(uint64_t ptr) {
1848         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1849         assert(obj->tag == LDKEvent_ProbeSuccessful);
1850                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1851                         memcpy(payment_hash_arr->elems, obj->probe_successful.payment_hash.data, 32);
1852         return payment_hash_arr;
1853 }
1854 uint64_tArray __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_path"))) TS_LDKEvent_ProbeSuccessful_get_path(uint64_t ptr) {
1855         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1856         assert(obj->tag == LDKEvent_ProbeSuccessful);
1857                         LDKCVec_RouteHopZ path_var = obj->probe_successful.path;
1858                         uint64_tArray path_arr = NULL;
1859                         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
1860                         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
1861                         for (size_t k = 0; k < path_var.datalen; k++) {
1862                                 LDKRouteHop path_conv_10_var = path_var.data[k];
1863                                 uint64_t path_conv_10_ref = 0;
1864                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1865                                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, false);
1866                                 path_arr_ptr[k] = path_conv_10_ref;
1867                         }
1868                         
1869         return path_arr;
1870 }
1871 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_payment_id"))) TS_LDKEvent_ProbeFailed_get_payment_id(uint64_t ptr) {
1872         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1873         assert(obj->tag == LDKEvent_ProbeFailed);
1874                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1875                         memcpy(payment_id_arr->elems, obj->probe_failed.payment_id.data, 32);
1876         return payment_id_arr;
1877 }
1878 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_payment_hash"))) TS_LDKEvent_ProbeFailed_get_payment_hash(uint64_t ptr) {
1879         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1880         assert(obj->tag == LDKEvent_ProbeFailed);
1881                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1882                         memcpy(payment_hash_arr->elems, obj->probe_failed.payment_hash.data, 32);
1883         return payment_hash_arr;
1884 }
1885 uint64_tArray __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_path"))) TS_LDKEvent_ProbeFailed_get_path(uint64_t ptr) {
1886         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1887         assert(obj->tag == LDKEvent_ProbeFailed);
1888                         LDKCVec_RouteHopZ path_var = obj->probe_failed.path;
1889                         uint64_tArray path_arr = NULL;
1890                         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
1891                         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
1892                         for (size_t k = 0; k < path_var.datalen; k++) {
1893                                 LDKRouteHop path_conv_10_var = path_var.data[k];
1894                                 uint64_t path_conv_10_ref = 0;
1895                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1896                                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, false);
1897                                 path_arr_ptr[k] = path_conv_10_ref;
1898                         }
1899                         
1900         return path_arr;
1901 }
1902 uint64_t __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_short_channel_id"))) TS_LDKEvent_ProbeFailed_get_short_channel_id(uint64_t ptr) {
1903         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1904         assert(obj->tag == LDKEvent_ProbeFailed);
1905                         uint64_t short_channel_id_ref = tag_ptr(&obj->probe_failed.short_channel_id, false);
1906         return short_channel_id_ref;
1907 }
1908 int64_t __attribute__((export_name("TS_LDKEvent_PendingHTLCsForwardable_get_time_forwardable"))) TS_LDKEvent_PendingHTLCsForwardable_get_time_forwardable(uint64_t ptr) {
1909         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1910         assert(obj->tag == LDKEvent_PendingHTLCsForwardable);
1911                         int64_t time_forwardable_conv = obj->pending_htl_cs_forwardable.time_forwardable;
1912         return time_forwardable_conv;
1913 }
1914 uint64_tArray __attribute__((export_name("TS_LDKEvent_SpendableOutputs_get_outputs"))) TS_LDKEvent_SpendableOutputs_get_outputs(uint64_t ptr) {
1915         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1916         assert(obj->tag == LDKEvent_SpendableOutputs);
1917                         LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
1918                         uint64_tArray outputs_arr = NULL;
1919                         outputs_arr = init_uint64_tArray(outputs_var.datalen, __LINE__);
1920                         uint64_t *outputs_arr_ptr = (uint64_t*)(((uint8_t*)outputs_arr) + 8);
1921                         for (size_t b = 0; b < outputs_var.datalen; b++) {
1922                                 uint64_t outputs_conv_27_ref = tag_ptr(&outputs_var.data[b], false);
1923                                 outputs_arr_ptr[b] = outputs_conv_27_ref;
1924                         }
1925                         
1926         return outputs_arr;
1927 }
1928 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_prev_channel_id"))) TS_LDKEvent_PaymentForwarded_get_prev_channel_id(uint64_t ptr) {
1929         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1930         assert(obj->tag == LDKEvent_PaymentForwarded);
1931                         int8_tArray prev_channel_id_arr = init_int8_tArray(32, __LINE__);
1932                         memcpy(prev_channel_id_arr->elems, obj->payment_forwarded.prev_channel_id.data, 32);
1933         return prev_channel_id_arr;
1934 }
1935 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_next_channel_id"))) TS_LDKEvent_PaymentForwarded_get_next_channel_id(uint64_t ptr) {
1936         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1937         assert(obj->tag == LDKEvent_PaymentForwarded);
1938                         int8_tArray next_channel_id_arr = init_int8_tArray(32, __LINE__);
1939                         memcpy(next_channel_id_arr->elems, obj->payment_forwarded.next_channel_id.data, 32);
1940         return next_channel_id_arr;
1941 }
1942 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_fee_earned_msat"))) TS_LDKEvent_PaymentForwarded_get_fee_earned_msat(uint64_t ptr) {
1943         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1944         assert(obj->tag == LDKEvent_PaymentForwarded);
1945                         uint64_t fee_earned_msat_ref = tag_ptr(&obj->payment_forwarded.fee_earned_msat, false);
1946         return fee_earned_msat_ref;
1947 }
1948 jboolean __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_claim_from_onchain_tx"))) TS_LDKEvent_PaymentForwarded_get_claim_from_onchain_tx(uint64_t ptr) {
1949         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1950         assert(obj->tag == LDKEvent_PaymentForwarded);
1951                         jboolean claim_from_onchain_tx_conv = obj->payment_forwarded.claim_from_onchain_tx;
1952         return claim_from_onchain_tx_conv;
1953 }
1954 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_channel_id"))) TS_LDKEvent_ChannelClosed_get_channel_id(uint64_t ptr) {
1955         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1956         assert(obj->tag == LDKEvent_ChannelClosed);
1957                         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
1958                         memcpy(channel_id_arr->elems, obj->channel_closed.channel_id.data, 32);
1959         return channel_id_arr;
1960 }
1961 int64_t __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_user_channel_id"))) TS_LDKEvent_ChannelClosed_get_user_channel_id(uint64_t ptr) {
1962         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1963         assert(obj->tag == LDKEvent_ChannelClosed);
1964                         int64_t user_channel_id_conv = obj->channel_closed.user_channel_id;
1965         return user_channel_id_conv;
1966 }
1967 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_reason"))) TS_LDKEvent_ChannelClosed_get_reason(uint64_t ptr) {
1968         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1969         assert(obj->tag == LDKEvent_ChannelClosed);
1970                         uint64_t reason_ref = tag_ptr(&obj->channel_closed.reason, false);
1971         return reason_ref;
1972 }
1973 int8_tArray __attribute__((export_name("TS_LDKEvent_DiscardFunding_get_channel_id"))) TS_LDKEvent_DiscardFunding_get_channel_id(uint64_t ptr) {
1974         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1975         assert(obj->tag == LDKEvent_DiscardFunding);
1976                         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
1977                         memcpy(channel_id_arr->elems, obj->discard_funding.channel_id.data, 32);
1978         return channel_id_arr;
1979 }
1980 int8_tArray __attribute__((export_name("TS_LDKEvent_DiscardFunding_get_transaction"))) TS_LDKEvent_DiscardFunding_get_transaction(uint64_t ptr) {
1981         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1982         assert(obj->tag == LDKEvent_DiscardFunding);
1983                         LDKTransaction transaction_var = obj->discard_funding.transaction;
1984                         int8_tArray transaction_arr = init_int8_tArray(transaction_var.datalen, __LINE__);
1985                         memcpy(transaction_arr->elems, transaction_var.data, transaction_var.datalen);
1986         return transaction_arr;
1987 }
1988 int8_tArray __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_temporary_channel_id"))) TS_LDKEvent_OpenChannelRequest_get_temporary_channel_id(uint64_t ptr) {
1989         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1990         assert(obj->tag == LDKEvent_OpenChannelRequest);
1991                         int8_tArray temporary_channel_id_arr = init_int8_tArray(32, __LINE__);
1992                         memcpy(temporary_channel_id_arr->elems, obj->open_channel_request.temporary_channel_id.data, 32);
1993         return temporary_channel_id_arr;
1994 }
1995 int8_tArray __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_counterparty_node_id"))) TS_LDKEvent_OpenChannelRequest_get_counterparty_node_id(uint64_t ptr) {
1996         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1997         assert(obj->tag == LDKEvent_OpenChannelRequest);
1998                         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
1999                         memcpy(counterparty_node_id_arr->elems, obj->open_channel_request.counterparty_node_id.compressed_form, 33);
2000         return counterparty_node_id_arr;
2001 }
2002 int64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_funding_satoshis"))) TS_LDKEvent_OpenChannelRequest_get_funding_satoshis(uint64_t ptr) {
2003         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2004         assert(obj->tag == LDKEvent_OpenChannelRequest);
2005                         int64_t funding_satoshis_conv = obj->open_channel_request.funding_satoshis;
2006         return funding_satoshis_conv;
2007 }
2008 int64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_push_msat"))) TS_LDKEvent_OpenChannelRequest_get_push_msat(uint64_t ptr) {
2009         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2010         assert(obj->tag == LDKEvent_OpenChannelRequest);
2011                         int64_t push_msat_conv = obj->open_channel_request.push_msat;
2012         return push_msat_conv;
2013 }
2014 uint64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_channel_type"))) TS_LDKEvent_OpenChannelRequest_get_channel_type(uint64_t ptr) {
2015         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2016         assert(obj->tag == LDKEvent_OpenChannelRequest);
2017                         LDKChannelTypeFeatures channel_type_var = obj->open_channel_request.channel_type;
2018                         uint64_t channel_type_ref = 0;
2019                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
2020                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
2021         return channel_type_ref;
2022 }
2023 int8_tArray __attribute__((export_name("TS_LDKEvent_HTLCHandlingFailed_get_prev_channel_id"))) TS_LDKEvent_HTLCHandlingFailed_get_prev_channel_id(uint64_t ptr) {
2024         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2025         assert(obj->tag == LDKEvent_HTLCHandlingFailed);
2026                         int8_tArray prev_channel_id_arr = init_int8_tArray(32, __LINE__);
2027                         memcpy(prev_channel_id_arr->elems, obj->htlc_handling_failed.prev_channel_id.data, 32);
2028         return prev_channel_id_arr;
2029 }
2030 uint64_t __attribute__((export_name("TS_LDKEvent_HTLCHandlingFailed_get_failed_next_destination"))) TS_LDKEvent_HTLCHandlingFailed_get_failed_next_destination(uint64_t ptr) {
2031         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2032         assert(obj->tag == LDKEvent_HTLCHandlingFailed);
2033                         uint64_t failed_next_destination_ref = tag_ptr(&obj->htlc_handling_failed.failed_next_destination, false);
2034         return failed_next_destination_ref;
2035 }
2036 uint32_t __attribute__((export_name("TS_LDKCOption_EventZ_ty_from_ptr"))) TS_LDKCOption_EventZ_ty_from_ptr(uint64_t ptr) {
2037         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
2038         switch(obj->tag) {
2039                 case LDKCOption_EventZ_Some: return 0;
2040                 case LDKCOption_EventZ_None: return 1;
2041                 default: abort();
2042         }
2043 }
2044 uint64_t __attribute__((export_name("TS_LDKCOption_EventZ_Some_get_some"))) TS_LDKCOption_EventZ_Some_get_some(uint64_t ptr) {
2045         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
2046         assert(obj->tag == LDKCOption_EventZ_Some);
2047                         uint64_t some_ref = tag_ptr(&obj->some, false);
2048         return some_ref;
2049 }
2050 static inline struct LDKCOption_EventZ CResult_COption_EventZDecodeErrorZ_get_ok(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
2051 CHECK(owner->result_ok);
2052         return COption_EventZ_clone(&*owner->contents.result);
2053 }
2054 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_get_ok"))) TS_CResult_COption_EventZDecodeErrorZ_get_ok(uint64_t owner) {
2055         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
2056         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
2057         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_ok(owner_conv);
2058         uint64_t ret_ref = tag_ptr(ret_copy, true);
2059         return ret_ref;
2060 }
2061
2062 static inline struct LDKDecodeError CResult_COption_EventZDecodeErrorZ_get_err(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
2063         LDKDecodeError ret = *owner->contents.err;
2064         ret.is_owned = false;
2065         return ret;
2066 }
2067 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_get_err"))) TS_CResult_COption_EventZDecodeErrorZ_get_err(uint64_t owner) {
2068         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
2069         LDKDecodeError ret_var = CResult_COption_EventZDecodeErrorZ_get_err(owner_conv);
2070         uint64_t ret_ref = 0;
2071         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2072         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2073         return ret_ref;
2074 }
2075
2076 uint32_t __attribute__((export_name("TS_LDKErrorAction_ty_from_ptr"))) TS_LDKErrorAction_ty_from_ptr(uint64_t ptr) {
2077         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
2078         switch(obj->tag) {
2079                 case LDKErrorAction_DisconnectPeer: return 0;
2080                 case LDKErrorAction_IgnoreError: return 1;
2081                 case LDKErrorAction_IgnoreAndLog: return 2;
2082                 case LDKErrorAction_IgnoreDuplicateGossip: return 3;
2083                 case LDKErrorAction_SendErrorMessage: return 4;
2084                 case LDKErrorAction_SendWarningMessage: return 5;
2085                 default: abort();
2086         }
2087 }
2088 uint64_t __attribute__((export_name("TS_LDKErrorAction_DisconnectPeer_get_msg"))) TS_LDKErrorAction_DisconnectPeer_get_msg(uint64_t ptr) {
2089         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
2090         assert(obj->tag == LDKErrorAction_DisconnectPeer);
2091                         LDKErrorMessage msg_var = obj->disconnect_peer.msg;
2092                         uint64_t msg_ref = 0;
2093                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2094                         msg_ref = tag_ptr(msg_var.inner, false);
2095         return msg_ref;
2096 }
2097 uint32_t __attribute__((export_name("TS_LDKErrorAction_IgnoreAndLog_get_ignore_and_log"))) TS_LDKErrorAction_IgnoreAndLog_get_ignore_and_log(uint64_t ptr) {
2098         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
2099         assert(obj->tag == LDKErrorAction_IgnoreAndLog);
2100                         uint32_t ignore_and_log_conv = LDKLevel_to_js(obj->ignore_and_log);
2101         return ignore_and_log_conv;
2102 }
2103 uint64_t __attribute__((export_name("TS_LDKErrorAction_SendErrorMessage_get_msg"))) TS_LDKErrorAction_SendErrorMessage_get_msg(uint64_t ptr) {
2104         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
2105         assert(obj->tag == LDKErrorAction_SendErrorMessage);
2106                         LDKErrorMessage msg_var = obj->send_error_message.msg;
2107                         uint64_t msg_ref = 0;
2108                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2109                         msg_ref = tag_ptr(msg_var.inner, false);
2110         return msg_ref;
2111 }
2112 uint64_t __attribute__((export_name("TS_LDKErrorAction_SendWarningMessage_get_msg"))) TS_LDKErrorAction_SendWarningMessage_get_msg(uint64_t ptr) {
2113         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
2114         assert(obj->tag == LDKErrorAction_SendWarningMessage);
2115                         LDKWarningMessage msg_var = obj->send_warning_message.msg;
2116                         uint64_t msg_ref = 0;
2117                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2118                         msg_ref = tag_ptr(msg_var.inner, false);
2119         return msg_ref;
2120 }
2121 uint32_t __attribute__((export_name("TS_LDKErrorAction_SendWarningMessage_get_log_level"))) TS_LDKErrorAction_SendWarningMessage_get_log_level(uint64_t ptr) {
2122         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
2123         assert(obj->tag == LDKErrorAction_SendWarningMessage);
2124                         uint32_t log_level_conv = LDKLevel_to_js(obj->send_warning_message.log_level);
2125         return log_level_conv;
2126 }
2127 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_ty_from_ptr"))) TS_LDKMessageSendEvent_ty_from_ptr(uint64_t ptr) {
2128         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2129         switch(obj->tag) {
2130                 case LDKMessageSendEvent_SendAcceptChannel: return 0;
2131                 case LDKMessageSendEvent_SendOpenChannel: return 1;
2132                 case LDKMessageSendEvent_SendFundingCreated: return 2;
2133                 case LDKMessageSendEvent_SendFundingSigned: return 3;
2134                 case LDKMessageSendEvent_SendChannelReady: return 4;
2135                 case LDKMessageSendEvent_SendAnnouncementSignatures: return 5;
2136                 case LDKMessageSendEvent_UpdateHTLCs: return 6;
2137                 case LDKMessageSendEvent_SendRevokeAndACK: return 7;
2138                 case LDKMessageSendEvent_SendClosingSigned: return 8;
2139                 case LDKMessageSendEvent_SendShutdown: return 9;
2140                 case LDKMessageSendEvent_SendChannelReestablish: return 10;
2141                 case LDKMessageSendEvent_SendChannelAnnouncement: return 11;
2142                 case LDKMessageSendEvent_BroadcastChannelAnnouncement: return 12;
2143                 case LDKMessageSendEvent_BroadcastChannelUpdate: return 13;
2144                 case LDKMessageSendEvent_SendChannelUpdate: return 14;
2145                 case LDKMessageSendEvent_HandleError: return 15;
2146                 case LDKMessageSendEvent_SendChannelRangeQuery: return 16;
2147                 case LDKMessageSendEvent_SendShortIdsQuery: return 17;
2148                 case LDKMessageSendEvent_SendReplyChannelRange: return 18;
2149                 case LDKMessageSendEvent_SendGossipTimestampFilter: return 19;
2150                 default: abort();
2151         }
2152 }
2153 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannel_get_node_id"))) TS_LDKMessageSendEvent_SendAcceptChannel_get_node_id(uint64_t ptr) {
2154         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2155         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
2156                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2157                         memcpy(node_id_arr->elems, obj->send_accept_channel.node_id.compressed_form, 33);
2158         return node_id_arr;
2159 }
2160 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannel_get_msg"))) TS_LDKMessageSendEvent_SendAcceptChannel_get_msg(uint64_t ptr) {
2161         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2162         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
2163                         LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
2164                         uint64_t msg_ref = 0;
2165                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2166                         msg_ref = tag_ptr(msg_var.inner, false);
2167         return msg_ref;
2168 }
2169 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannel_get_node_id"))) TS_LDKMessageSendEvent_SendOpenChannel_get_node_id(uint64_t ptr) {
2170         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2171         assert(obj->tag == LDKMessageSendEvent_SendOpenChannel);
2172                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2173                         memcpy(node_id_arr->elems, obj->send_open_channel.node_id.compressed_form, 33);
2174         return node_id_arr;
2175 }
2176 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannel_get_msg"))) TS_LDKMessageSendEvent_SendOpenChannel_get_msg(uint64_t ptr) {
2177         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2178         assert(obj->tag == LDKMessageSendEvent_SendOpenChannel);
2179                         LDKOpenChannel msg_var = obj->send_open_channel.msg;
2180                         uint64_t msg_ref = 0;
2181                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2182                         msg_ref = tag_ptr(msg_var.inner, false);
2183         return msg_ref;
2184 }
2185 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingCreated_get_node_id"))) TS_LDKMessageSendEvent_SendFundingCreated_get_node_id(uint64_t ptr) {
2186         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2187         assert(obj->tag == LDKMessageSendEvent_SendFundingCreated);
2188                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2189                         memcpy(node_id_arr->elems, obj->send_funding_created.node_id.compressed_form, 33);
2190         return node_id_arr;
2191 }
2192 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingCreated_get_msg"))) TS_LDKMessageSendEvent_SendFundingCreated_get_msg(uint64_t ptr) {
2193         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2194         assert(obj->tag == LDKMessageSendEvent_SendFundingCreated);
2195                         LDKFundingCreated msg_var = obj->send_funding_created.msg;
2196                         uint64_t msg_ref = 0;
2197                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2198                         msg_ref = tag_ptr(msg_var.inner, false);
2199         return msg_ref;
2200 }
2201 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingSigned_get_node_id"))) TS_LDKMessageSendEvent_SendFundingSigned_get_node_id(uint64_t ptr) {
2202         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2203         assert(obj->tag == LDKMessageSendEvent_SendFundingSigned);
2204                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2205                         memcpy(node_id_arr->elems, obj->send_funding_signed.node_id.compressed_form, 33);
2206         return node_id_arr;
2207 }
2208 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingSigned_get_msg"))) TS_LDKMessageSendEvent_SendFundingSigned_get_msg(uint64_t ptr) {
2209         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2210         assert(obj->tag == LDKMessageSendEvent_SendFundingSigned);
2211                         LDKFundingSigned msg_var = obj->send_funding_signed.msg;
2212                         uint64_t msg_ref = 0;
2213                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2214                         msg_ref = tag_ptr(msg_var.inner, false);
2215         return msg_ref;
2216 }
2217 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReady_get_node_id"))) TS_LDKMessageSendEvent_SendChannelReady_get_node_id(uint64_t ptr) {
2218         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2219         assert(obj->tag == LDKMessageSendEvent_SendChannelReady);
2220                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2221                         memcpy(node_id_arr->elems, obj->send_channel_ready.node_id.compressed_form, 33);
2222         return node_id_arr;
2223 }
2224 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReady_get_msg"))) TS_LDKMessageSendEvent_SendChannelReady_get_msg(uint64_t ptr) {
2225         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2226         assert(obj->tag == LDKMessageSendEvent_SendChannelReady);
2227                         LDKChannelReady msg_var = obj->send_channel_ready.msg;
2228                         uint64_t msg_ref = 0;
2229                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2230                         msg_ref = tag_ptr(msg_var.inner, false);
2231         return msg_ref;
2232 }
2233 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_node_id"))) TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_node_id(uint64_t ptr) {
2234         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2235         assert(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
2236                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2237                         memcpy(node_id_arr->elems, obj->send_announcement_signatures.node_id.compressed_form, 33);
2238         return node_id_arr;
2239 }
2240 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_msg"))) TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_msg(uint64_t ptr) {
2241         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2242         assert(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
2243                         LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
2244                         uint64_t msg_ref = 0;
2245                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2246                         msg_ref = tag_ptr(msg_var.inner, false);
2247         return msg_ref;
2248 }
2249 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_UpdateHTLCs_get_node_id"))) TS_LDKMessageSendEvent_UpdateHTLCs_get_node_id(uint64_t ptr) {
2250         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2251         assert(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
2252                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2253                         memcpy(node_id_arr->elems, obj->update_htl_cs.node_id.compressed_form, 33);
2254         return node_id_arr;
2255 }
2256 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_UpdateHTLCs_get_updates"))) TS_LDKMessageSendEvent_UpdateHTLCs_get_updates(uint64_t ptr) {
2257         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2258         assert(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
2259                         LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
2260                         uint64_t updates_ref = 0;
2261                         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_var);
2262                         updates_ref = tag_ptr(updates_var.inner, false);
2263         return updates_ref;
2264 }
2265 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendRevokeAndACK_get_node_id"))) TS_LDKMessageSendEvent_SendRevokeAndACK_get_node_id(uint64_t ptr) {
2266         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2267         assert(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
2268                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2269                         memcpy(node_id_arr->elems, obj->send_revoke_and_ack.node_id.compressed_form, 33);
2270         return node_id_arr;
2271 }
2272 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendRevokeAndACK_get_msg"))) TS_LDKMessageSendEvent_SendRevokeAndACK_get_msg(uint64_t ptr) {
2273         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2274         assert(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
2275                         LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
2276                         uint64_t msg_ref = 0;
2277                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2278                         msg_ref = tag_ptr(msg_var.inner, false);
2279         return msg_ref;
2280 }
2281 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendClosingSigned_get_node_id"))) TS_LDKMessageSendEvent_SendClosingSigned_get_node_id(uint64_t ptr) {
2282         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2283         assert(obj->tag == LDKMessageSendEvent_SendClosingSigned);
2284                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2285                         memcpy(node_id_arr->elems, obj->send_closing_signed.node_id.compressed_form, 33);
2286         return node_id_arr;
2287 }
2288 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendClosingSigned_get_msg"))) TS_LDKMessageSendEvent_SendClosingSigned_get_msg(uint64_t ptr) {
2289         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2290         assert(obj->tag == LDKMessageSendEvent_SendClosingSigned);
2291                         LDKClosingSigned msg_var = obj->send_closing_signed.msg;
2292                         uint64_t msg_ref = 0;
2293                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2294                         msg_ref = tag_ptr(msg_var.inner, false);
2295         return msg_ref;
2296 }
2297 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendShutdown_get_node_id"))) TS_LDKMessageSendEvent_SendShutdown_get_node_id(uint64_t ptr) {
2298         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2299         assert(obj->tag == LDKMessageSendEvent_SendShutdown);
2300                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2301                         memcpy(node_id_arr->elems, obj->send_shutdown.node_id.compressed_form, 33);
2302         return node_id_arr;
2303 }
2304 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendShutdown_get_msg"))) TS_LDKMessageSendEvent_SendShutdown_get_msg(uint64_t ptr) {
2305         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2306         assert(obj->tag == LDKMessageSendEvent_SendShutdown);
2307                         LDKShutdown msg_var = obj->send_shutdown.msg;
2308                         uint64_t msg_ref = 0;
2309                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2310                         msg_ref = tag_ptr(msg_var.inner, false);
2311         return msg_ref;
2312 }
2313 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReestablish_get_node_id"))) TS_LDKMessageSendEvent_SendChannelReestablish_get_node_id(uint64_t ptr) {
2314         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2315         assert(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
2316                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2317                         memcpy(node_id_arr->elems, obj->send_channel_reestablish.node_id.compressed_form, 33);
2318         return node_id_arr;
2319 }
2320 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReestablish_get_msg"))) TS_LDKMessageSendEvent_SendChannelReestablish_get_msg(uint64_t ptr) {
2321         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2322         assert(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
2323                         LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
2324                         uint64_t msg_ref = 0;
2325                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2326                         msg_ref = tag_ptr(msg_var.inner, false);
2327         return msg_ref;
2328 }
2329 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelAnnouncement_get_node_id"))) TS_LDKMessageSendEvent_SendChannelAnnouncement_get_node_id(uint64_t ptr) {
2330         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2331         assert(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
2332                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2333                         memcpy(node_id_arr->elems, obj->send_channel_announcement.node_id.compressed_form, 33);
2334         return node_id_arr;
2335 }
2336 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelAnnouncement_get_msg"))) TS_LDKMessageSendEvent_SendChannelAnnouncement_get_msg(uint64_t ptr) {
2337         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2338         assert(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
2339                         LDKChannelAnnouncement msg_var = obj->send_channel_announcement.msg;
2340                         uint64_t msg_ref = 0;
2341                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2342                         msg_ref = tag_ptr(msg_var.inner, false);
2343         return msg_ref;
2344 }
2345 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelAnnouncement_get_update_msg"))) TS_LDKMessageSendEvent_SendChannelAnnouncement_get_update_msg(uint64_t ptr) {
2346         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2347         assert(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
2348                         LDKChannelUpdate update_msg_var = obj->send_channel_announcement.update_msg;
2349                         uint64_t update_msg_ref = 0;
2350                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
2351                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
2352         return update_msg_ref;
2353 }
2354 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_msg"))) TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_msg(uint64_t ptr) {
2355         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2356         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
2357                         LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
2358                         uint64_t msg_ref = 0;
2359                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2360                         msg_ref = tag_ptr(msg_var.inner, false);
2361         return msg_ref;
2362 }
2363 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_update_msg"))) TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_update_msg(uint64_t ptr) {
2364         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2365         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
2366                         LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
2367                         uint64_t update_msg_ref = 0;
2368                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
2369                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
2370         return update_msg_ref;
2371 }
2372 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelUpdate_get_msg"))) TS_LDKMessageSendEvent_BroadcastChannelUpdate_get_msg(uint64_t ptr) {
2373         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2374         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelUpdate);
2375                         LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
2376                         uint64_t msg_ref = 0;
2377                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2378                         msg_ref = tag_ptr(msg_var.inner, false);
2379         return msg_ref;
2380 }
2381 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelUpdate_get_node_id"))) TS_LDKMessageSendEvent_SendChannelUpdate_get_node_id(uint64_t ptr) {
2382         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2383         assert(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
2384                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2385                         memcpy(node_id_arr->elems, obj->send_channel_update.node_id.compressed_form, 33);
2386         return node_id_arr;
2387 }
2388 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelUpdate_get_msg"))) TS_LDKMessageSendEvent_SendChannelUpdate_get_msg(uint64_t ptr) {
2389         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2390         assert(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
2391                         LDKChannelUpdate msg_var = obj->send_channel_update.msg;
2392                         uint64_t msg_ref = 0;
2393                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2394                         msg_ref = tag_ptr(msg_var.inner, false);
2395         return msg_ref;
2396 }
2397 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_HandleError_get_node_id"))) TS_LDKMessageSendEvent_HandleError_get_node_id(uint64_t ptr) {
2398         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2399         assert(obj->tag == LDKMessageSendEvent_HandleError);
2400                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2401                         memcpy(node_id_arr->elems, obj->handle_error.node_id.compressed_form, 33);
2402         return node_id_arr;
2403 }
2404 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_HandleError_get_action"))) TS_LDKMessageSendEvent_HandleError_get_action(uint64_t ptr) {
2405         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2406         assert(obj->tag == LDKMessageSendEvent_HandleError);
2407                         uint64_t action_ref = tag_ptr(&obj->handle_error.action, false);
2408         return action_ref;
2409 }
2410 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelRangeQuery_get_node_id"))) TS_LDKMessageSendEvent_SendChannelRangeQuery_get_node_id(uint64_t ptr) {
2411         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2412         assert(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
2413                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2414                         memcpy(node_id_arr->elems, obj->send_channel_range_query.node_id.compressed_form, 33);
2415         return node_id_arr;
2416 }
2417 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelRangeQuery_get_msg"))) TS_LDKMessageSendEvent_SendChannelRangeQuery_get_msg(uint64_t ptr) {
2418         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2419         assert(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
2420                         LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
2421                         uint64_t msg_ref = 0;
2422                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2423                         msg_ref = tag_ptr(msg_var.inner, false);
2424         return msg_ref;
2425 }
2426 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendShortIdsQuery_get_node_id"))) TS_LDKMessageSendEvent_SendShortIdsQuery_get_node_id(uint64_t ptr) {
2427         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2428         assert(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
2429                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2430                         memcpy(node_id_arr->elems, obj->send_short_ids_query.node_id.compressed_form, 33);
2431         return node_id_arr;
2432 }
2433 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendShortIdsQuery_get_msg"))) TS_LDKMessageSendEvent_SendShortIdsQuery_get_msg(uint64_t ptr) {
2434         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2435         assert(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
2436                         LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
2437                         uint64_t msg_ref = 0;
2438                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2439                         msg_ref = tag_ptr(msg_var.inner, false);
2440         return msg_ref;
2441 }
2442 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendReplyChannelRange_get_node_id"))) TS_LDKMessageSendEvent_SendReplyChannelRange_get_node_id(uint64_t ptr) {
2443         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2444         assert(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
2445                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2446                         memcpy(node_id_arr->elems, obj->send_reply_channel_range.node_id.compressed_form, 33);
2447         return node_id_arr;
2448 }
2449 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendReplyChannelRange_get_msg"))) TS_LDKMessageSendEvent_SendReplyChannelRange_get_msg(uint64_t ptr) {
2450         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2451         assert(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
2452                         LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
2453                         uint64_t msg_ref = 0;
2454                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2455                         msg_ref = tag_ptr(msg_var.inner, false);
2456         return msg_ref;
2457 }
2458 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_node_id"))) TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_node_id(uint64_t ptr) {
2459         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2460         assert(obj->tag == LDKMessageSendEvent_SendGossipTimestampFilter);
2461                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2462                         memcpy(node_id_arr->elems, obj->send_gossip_timestamp_filter.node_id.compressed_form, 33);
2463         return node_id_arr;
2464 }
2465 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_msg"))) TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_msg(uint64_t ptr) {
2466         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2467         assert(obj->tag == LDKMessageSendEvent_SendGossipTimestampFilter);
2468                         LDKGossipTimestampFilter msg_var = obj->send_gossip_timestamp_filter.msg;
2469                         uint64_t msg_ref = 0;
2470                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2471                         msg_ref = tag_ptr(msg_var.inner, false);
2472         return msg_ref;
2473 }
2474 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
2475         LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
2476         for (size_t i = 0; i < ret.datalen; i++) {
2477                 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
2478         }
2479         return ret;
2480 }
2481 static inline struct LDKTxOut CResult_TxOutAccessErrorZ_get_ok(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner){
2482 CHECK(owner->result_ok);
2483         return TxOut_clone(&*owner->contents.result);
2484 }
2485 uint64_t  __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_get_ok"))) TS_CResult_TxOutAccessErrorZ_get_ok(uint64_t owner) {
2486         LDKCResult_TxOutAccessErrorZ* owner_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(owner);
2487         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
2488         *ret_ref = CResult_TxOutAccessErrorZ_get_ok(owner_conv);
2489         return tag_ptr(ret_ref, true);
2490 }
2491
2492 static inline enum LDKAccessError CResult_TxOutAccessErrorZ_get_err(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner){
2493 CHECK(!owner->result_ok);
2494         return AccessError_clone(&*owner->contents.err);
2495 }
2496 uint32_t  __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_get_err"))) TS_CResult_TxOutAccessErrorZ_get_err(uint64_t owner) {
2497         LDKCResult_TxOutAccessErrorZ* owner_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(owner);
2498         uint32_t ret_conv = LDKAccessError_to_js(CResult_TxOutAccessErrorZ_get_err(owner_conv));
2499         return ret_conv;
2500 }
2501
2502 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
2503         return owner->a;
2504 }
2505 uint32_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_get_a"))) TS_C2Tuple_usizeTransactionZ_get_a(uint64_t owner) {
2506         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
2507         uint32_t ret_conv = C2Tuple_usizeTransactionZ_get_a(owner_conv);
2508         return ret_conv;
2509 }
2510
2511 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
2512         return owner->b;
2513 }
2514 int8_tArray  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_get_b"))) TS_C2Tuple_usizeTransactionZ_get_b(uint64_t owner) {
2515         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
2516         LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(owner_conv);
2517         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2518         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2519         return ret_arr;
2520 }
2521
2522 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
2523         LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
2524         for (size_t i = 0; i < ret.datalen; i++) {
2525                 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
2526         }
2527         return ret;
2528 }
2529 static inline LDKCVec_TxidZ CVec_TxidZ_clone(const LDKCVec_TxidZ *orig) {
2530         LDKCVec_TxidZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_TxidZ clone bytes"), .datalen = orig->datalen };
2531         for (size_t i = 0; i < ret.datalen; i++) {
2532                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
2533         }
2534         return ret;
2535 }
2536 static inline void CResult_NoneChannelMonitorUpdateErrZ_get_ok(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR owner){
2537 CHECK(owner->result_ok);
2538         return *owner->contents.result;
2539 }
2540 void  __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_get_ok"))) TS_CResult_NoneChannelMonitorUpdateErrZ_get_ok(uint64_t owner) {
2541         LDKCResult_NoneChannelMonitorUpdateErrZ* owner_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)untag_ptr(owner);
2542         CResult_NoneChannelMonitorUpdateErrZ_get_ok(owner_conv);
2543 }
2544
2545 static inline enum LDKChannelMonitorUpdateErr CResult_NoneChannelMonitorUpdateErrZ_get_err(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR owner){
2546 CHECK(!owner->result_ok);
2547         return ChannelMonitorUpdateErr_clone(&*owner->contents.err);
2548 }
2549 uint32_t  __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_get_err"))) TS_CResult_NoneChannelMonitorUpdateErrZ_get_err(uint64_t owner) {
2550         LDKCResult_NoneChannelMonitorUpdateErrZ* owner_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)untag_ptr(owner);
2551         uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(CResult_NoneChannelMonitorUpdateErrZ_get_err(owner_conv));
2552         return ret_conv;
2553 }
2554
2555 uint32_t __attribute__((export_name("TS_LDKMonitorEvent_ty_from_ptr"))) TS_LDKMonitorEvent_ty_from_ptr(uint64_t ptr) {
2556         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2557         switch(obj->tag) {
2558                 case LDKMonitorEvent_HTLCEvent: return 0;
2559                 case LDKMonitorEvent_CommitmentTxConfirmed: return 1;
2560                 case LDKMonitorEvent_UpdateCompleted: return 2;
2561                 case LDKMonitorEvent_UpdateFailed: return 3;
2562                 default: abort();
2563         }
2564 }
2565 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_HTLCEvent_get_htlc_event"))) TS_LDKMonitorEvent_HTLCEvent_get_htlc_event(uint64_t ptr) {
2566         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2567         assert(obj->tag == LDKMonitorEvent_HTLCEvent);
2568                         LDKHTLCUpdate htlc_event_var = obj->htlc_event;
2569                         uint64_t htlc_event_ref = 0;
2570                         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_event_var);
2571                         htlc_event_ref = tag_ptr(htlc_event_var.inner, false);
2572         return htlc_event_ref;
2573 }
2574 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_CommitmentTxConfirmed_get_commitment_tx_confirmed"))) TS_LDKMonitorEvent_CommitmentTxConfirmed_get_commitment_tx_confirmed(uint64_t ptr) {
2575         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2576         assert(obj->tag == LDKMonitorEvent_CommitmentTxConfirmed);
2577                         LDKOutPoint commitment_tx_confirmed_var = obj->commitment_tx_confirmed;
2578                         uint64_t commitment_tx_confirmed_ref = 0;
2579                         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_confirmed_var);
2580                         commitment_tx_confirmed_ref = tag_ptr(commitment_tx_confirmed_var.inner, false);
2581         return commitment_tx_confirmed_ref;
2582 }
2583 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_UpdateCompleted_get_funding_txo"))) TS_LDKMonitorEvent_UpdateCompleted_get_funding_txo(uint64_t ptr) {
2584         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2585         assert(obj->tag == LDKMonitorEvent_UpdateCompleted);
2586                         LDKOutPoint funding_txo_var = obj->update_completed.funding_txo;
2587                         uint64_t funding_txo_ref = 0;
2588                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
2589                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
2590         return funding_txo_ref;
2591 }
2592 int64_t __attribute__((export_name("TS_LDKMonitorEvent_UpdateCompleted_get_monitor_update_id"))) TS_LDKMonitorEvent_UpdateCompleted_get_monitor_update_id(uint64_t ptr) {
2593         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2594         assert(obj->tag == LDKMonitorEvent_UpdateCompleted);
2595                         int64_t monitor_update_id_conv = obj->update_completed.monitor_update_id;
2596         return monitor_update_id_conv;
2597 }
2598 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_UpdateFailed_get_update_failed"))) TS_LDKMonitorEvent_UpdateFailed_get_update_failed(uint64_t ptr) {
2599         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2600         assert(obj->tag == LDKMonitorEvent_UpdateFailed);
2601                         LDKOutPoint update_failed_var = obj->update_failed;
2602                         uint64_t update_failed_ref = 0;
2603                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_failed_var);
2604                         update_failed_ref = tag_ptr(update_failed_var.inner, false);
2605         return update_failed_ref;
2606 }
2607 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
2608         LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
2609         for (size_t i = 0; i < ret.datalen; i++) {
2610                 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
2611         }
2612         return ret;
2613 }
2614 static inline struct LDKOutPoint C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
2615         LDKOutPoint ret = owner->a;
2616         ret.is_owned = false;
2617         return ret;
2618 }
2619 uint64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(uint64_t owner) {
2620         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
2621         LDKOutPoint ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(owner_conv);
2622         uint64_t ret_ref = 0;
2623         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2624         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2625         return ret_ref;
2626 }
2627
2628 static inline struct LDKCVec_MonitorEventZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
2629         return CVec_MonitorEventZ_clone(&owner->b);
2630 }
2631 uint64_tArray  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(uint64_t owner) {
2632         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
2633         LDKCVec_MonitorEventZ ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(owner_conv);
2634         uint64_tArray ret_arr = NULL;
2635         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
2636         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
2637         for (size_t o = 0; o < ret_var.datalen; o++) {
2638                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
2639                 *ret_conv_14_copy = ret_var.data[o];
2640                 uint64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
2641                 ret_arr_ptr[o] = ret_conv_14_ref;
2642         }
2643         
2644         FREE(ret_var.data);
2645         return ret_arr;
2646 }
2647
2648 static inline struct LDKPublicKey C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
2649         return owner->c;
2650 }
2651 int8_tArray  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(uint64_t owner) {
2652         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
2653         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
2654         memcpy(ret_arr->elems, C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(owner_conv).compressed_form, 33);
2655         return ret_arr;
2656 }
2657
2658 static inline LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_clone(const LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ *orig) {
2659         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) * orig->datalen, "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ clone bytes"), .datalen = orig->datalen };
2660         for (size_t i = 0; i < ret.datalen; i++) {
2661                 ret.data[i] = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(&orig->data[i]);
2662         }
2663         return ret;
2664 }
2665 static inline struct LDKFixedPenaltyScorer CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
2666         LDKFixedPenaltyScorer ret = *owner->contents.result;
2667         ret.is_owned = false;
2668         return ret;
2669 }
2670 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(uint64_t owner) {
2671         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
2672         LDKFixedPenaltyScorer ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(owner_conv);
2673         uint64_t ret_ref = 0;
2674         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2675         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2676         return ret_ref;
2677 }
2678
2679 static inline struct LDKDecodeError CResult_FixedPenaltyScorerDecodeErrorZ_get_err(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
2680         LDKDecodeError ret = *owner->contents.err;
2681         ret.is_owned = false;
2682         return ret;
2683 }
2684 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_err"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_err(uint64_t owner) {
2685         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
2686         LDKDecodeError ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_err(owner_conv);
2687         uint64_t ret_ref = 0;
2688         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2689         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2690         return ret_ref;
2691 }
2692
2693 static inline uint64_t C2Tuple_u64u64Z_get_a(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
2694         return owner->a;
2695 }
2696 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_get_a"))) TS_C2Tuple_u64u64Z_get_a(uint64_t owner) {
2697         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
2698         int64_t ret_conv = C2Tuple_u64u64Z_get_a(owner_conv);
2699         return ret_conv;
2700 }
2701
2702 static inline uint64_t C2Tuple_u64u64Z_get_b(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
2703         return owner->b;
2704 }
2705 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_get_b"))) TS_C2Tuple_u64u64Z_get_b(uint64_t owner) {
2706         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
2707         int64_t ret_conv = C2Tuple_u64u64Z_get_b(owner_conv);
2708         return ret_conv;
2709 }
2710
2711 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u64ZZ_ty_from_ptr"))) TS_LDKCOption_C2Tuple_u64u64ZZ_ty_from_ptr(uint64_t ptr) {
2712         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
2713         switch(obj->tag) {
2714                 case LDKCOption_C2Tuple_u64u64ZZ_Some: return 0;
2715                 case LDKCOption_C2Tuple_u64u64ZZ_None: return 1;
2716                 default: abort();
2717         }
2718 }
2719 uint64_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u64ZZ_Some_get_some"))) TS_LDKCOption_C2Tuple_u64u64ZZ_Some_get_some(uint64_t ptr) {
2720         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
2721         assert(obj->tag == LDKCOption_C2Tuple_u64u64ZZ_Some);
2722                         LDKC2Tuple_u64u64Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
2723                         *some_conv = obj->some;
2724                         *some_conv = C2Tuple_u64u64Z_clone(some_conv);
2725         return tag_ptr(some_conv, true);
2726 }
2727 static inline LDKCVec_NodeIdZ CVec_NodeIdZ_clone(const LDKCVec_NodeIdZ *orig) {
2728         LDKCVec_NodeIdZ ret = { .data = MALLOC(sizeof(LDKNodeId) * orig->datalen, "LDKCVec_NodeIdZ clone bytes"), .datalen = orig->datalen };
2729         for (size_t i = 0; i < ret.datalen; i++) {
2730                 ret.data[i] = NodeId_clone(&orig->data[i]);
2731         }
2732         return ret;
2733 }
2734 typedef struct LDKLogger_JCalls {
2735         atomic_size_t refcnt;
2736         uint32_t instance_ptr;
2737 } LDKLogger_JCalls;
2738 static void LDKLogger_JCalls_free(void* this_arg) {
2739         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2740         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2741                 FREE(j_calls);
2742         }
2743 }
2744 void log_LDKLogger_jcall(const void* this_arg, const LDKRecord * record) {
2745         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2746         LDKRecord record_var = *record;
2747         uint64_t record_ref = 0;
2748         record_var = Record_clone(&record_var);
2749         CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
2750         record_ref = tag_ptr(record_var.inner, record_var.is_owned);
2751         js_invoke_function_buuuuu(j_calls->instance_ptr, 0, record_ref, 0, 0, 0, 0, 0);
2752 }
2753 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
2754         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
2755         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2756 }
2757 static inline LDKLogger LDKLogger_init (JSValue o) {
2758         LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
2759         atomic_init(&calls->refcnt, 1);
2760         calls->instance_ptr = o;
2761
2762         LDKLogger ret = {
2763                 .this_arg = (void*) calls,
2764                 .log = log_LDKLogger_jcall,
2765                 .free = LDKLogger_JCalls_free,
2766         };
2767         return ret;
2768 }
2769 uint64_t  __attribute__((export_name("TS_LDKLogger_new"))) TS_LDKLogger_new(JSValue o) {
2770         LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
2771         *res_ptr = LDKLogger_init(o);
2772         return tag_ptr(res_ptr, true);
2773 }
2774 static inline struct LDKProbabilisticScorer CResult_ProbabilisticScorerDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
2775         LDKProbabilisticScorer ret = *owner->contents.result;
2776         ret.is_owned = false;
2777         return ret;
2778 }
2779 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_get_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_get_ok(uint64_t owner) {
2780         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
2781         LDKProbabilisticScorer ret_var = CResult_ProbabilisticScorerDecodeErrorZ_get_ok(owner_conv);
2782         uint64_t ret_ref = 0;
2783         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2784         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2785         return ret_ref;
2786 }
2787
2788 static inline struct LDKDecodeError CResult_ProbabilisticScorerDecodeErrorZ_get_err(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
2789         LDKDecodeError ret = *owner->contents.err;
2790         ret.is_owned = false;
2791         return ret;
2792 }
2793 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_get_err"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_get_err(uint64_t owner) {
2794         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
2795         LDKDecodeError ret_var = CResult_ProbabilisticScorerDecodeErrorZ_get_err(owner_conv);
2796         uint64_t ret_ref = 0;
2797         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2798         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2799         return ret_ref;
2800 }
2801
2802 static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
2803         LDKInitFeatures ret = *owner->contents.result;
2804         ret.is_owned = false;
2805         return ret;
2806 }
2807 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_get_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
2808         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
2809         LDKInitFeatures ret_var = CResult_InitFeaturesDecodeErrorZ_get_ok(owner_conv);
2810         uint64_t ret_ref = 0;
2811         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2812         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2813         return ret_ref;
2814 }
2815
2816 static inline struct LDKDecodeError CResult_InitFeaturesDecodeErrorZ_get_err(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
2817         LDKDecodeError ret = *owner->contents.err;
2818         ret.is_owned = false;
2819         return ret;
2820 }
2821 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_get_err"))) TS_CResult_InitFeaturesDecodeErrorZ_get_err(uint64_t owner) {
2822         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
2823         LDKDecodeError ret_var = CResult_InitFeaturesDecodeErrorZ_get_err(owner_conv);
2824         uint64_t ret_ref = 0;
2825         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2826         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2827         return ret_ref;
2828 }
2829
2830 static inline struct LDKChannelFeatures CResult_ChannelFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
2831         LDKChannelFeatures ret = *owner->contents.result;
2832         ret.is_owned = false;
2833         return ret;
2834 }
2835 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_get_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
2836         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
2837         LDKChannelFeatures ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_ok(owner_conv);
2838         uint64_t ret_ref = 0;
2839         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2840         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2841         return ret_ref;
2842 }
2843
2844 static inline struct LDKDecodeError CResult_ChannelFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
2845         LDKDecodeError ret = *owner->contents.err;
2846         ret.is_owned = false;
2847         return ret;
2848 }
2849 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_get_err"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_err(uint64_t owner) {
2850         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
2851         LDKDecodeError ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_err(owner_conv);
2852         uint64_t ret_ref = 0;
2853         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2854         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2855         return ret_ref;
2856 }
2857
2858 static inline struct LDKNodeFeatures CResult_NodeFeaturesDecodeErrorZ_get_ok(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
2859         LDKNodeFeatures ret = *owner->contents.result;
2860         ret.is_owned = false;
2861         return ret;
2862 }
2863 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_get_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
2864         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
2865         LDKNodeFeatures ret_var = CResult_NodeFeaturesDecodeErrorZ_get_ok(owner_conv);
2866         uint64_t ret_ref = 0;
2867         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2868         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2869         return ret_ref;
2870 }
2871
2872 static inline struct LDKDecodeError CResult_NodeFeaturesDecodeErrorZ_get_err(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
2873         LDKDecodeError ret = *owner->contents.err;
2874         ret.is_owned = false;
2875         return ret;
2876 }
2877 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_get_err"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_err(uint64_t owner) {
2878         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
2879         LDKDecodeError ret_var = CResult_NodeFeaturesDecodeErrorZ_get_err(owner_conv);
2880         uint64_t ret_ref = 0;
2881         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2882         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2883         return ret_ref;
2884 }
2885
2886 static inline struct LDKInvoiceFeatures CResult_InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
2887         LDKInvoiceFeatures ret = *owner->contents.result;
2888         ret.is_owned = false;
2889         return ret;
2890 }
2891 uint64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_get_ok"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
2892         LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
2893         LDKInvoiceFeatures ret_var = CResult_InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
2894         uint64_t ret_ref = 0;
2895         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2896         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2897         return ret_ref;
2898 }
2899
2900 static inline struct LDKDecodeError CResult_InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
2901         LDKDecodeError ret = *owner->contents.err;
2902         ret.is_owned = false;
2903         return ret;
2904 }
2905 uint64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_get_err"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_get_err(uint64_t owner) {
2906         LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
2907         LDKDecodeError ret_var = CResult_InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
2908         uint64_t ret_ref = 0;
2909         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2910         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2911         return ret_ref;
2912 }
2913
2914 static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
2915         LDKChannelTypeFeatures ret = *owner->contents.result;
2916         ret.is_owned = false;
2917         return ret;
2918 }
2919 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
2920         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
2921         LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv);
2922         uint64_t ret_ref = 0;
2923         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2924         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2925         return ret_ref;
2926 }
2927
2928 static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
2929         LDKDecodeError ret = *owner->contents.err;
2930         ret.is_owned = false;
2931         return ret;
2932 }
2933 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(uint64_t owner) {
2934         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
2935         LDKDecodeError ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv);
2936         uint64_t ret_ref = 0;
2937         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2938         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2939         return ret_ref;
2940 }
2941
2942 static inline struct LDKNodeId CResult_NodeIdDecodeErrorZ_get_ok(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
2943         LDKNodeId ret = *owner->contents.result;
2944         ret.is_owned = false;
2945         return ret;
2946 }
2947 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_get_ok"))) TS_CResult_NodeIdDecodeErrorZ_get_ok(uint64_t owner) {
2948         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
2949         LDKNodeId ret_var = CResult_NodeIdDecodeErrorZ_get_ok(owner_conv);
2950         uint64_t ret_ref = 0;
2951         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2952         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2953         return ret_ref;
2954 }
2955
2956 static inline struct LDKDecodeError CResult_NodeIdDecodeErrorZ_get_err(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
2957         LDKDecodeError ret = *owner->contents.err;
2958         ret.is_owned = false;
2959         return ret;
2960 }
2961 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_get_err"))) TS_CResult_NodeIdDecodeErrorZ_get_err(uint64_t owner) {
2962         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
2963         LDKDecodeError ret_var = CResult_NodeIdDecodeErrorZ_get_err(owner_conv);
2964         uint64_t ret_ref = 0;
2965         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2966         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2967         return ret_ref;
2968 }
2969
2970 static inline struct LDKCOption_NetworkUpdateZ CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
2971 CHECK(owner->result_ok);
2972         return COption_NetworkUpdateZ_clone(&*owner->contents.result);
2973 }
2974 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(uint64_t owner) {
2975         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
2976         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
2977         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(owner_conv);
2978         uint64_t ret_ref = tag_ptr(ret_copy, true);
2979         return ret_ref;
2980 }
2981
2982 static inline struct LDKDecodeError CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
2983         LDKDecodeError ret = *owner->contents.err;
2984         ret.is_owned = false;
2985         return ret;
2986 }
2987 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(uint64_t owner) {
2988         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
2989         LDKDecodeError ret_var = CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(owner_conv);
2990         uint64_t ret_ref = 0;
2991         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2992         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2993         return ret_ref;
2994 }
2995
2996 typedef struct LDKAccess_JCalls {
2997         atomic_size_t refcnt;
2998         uint32_t instance_ptr;
2999 } LDKAccess_JCalls;
3000 static void LDKAccess_JCalls_free(void* this_arg) {
3001         LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
3002         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3003                 FREE(j_calls);
3004         }
3005 }
3006 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
3007         LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
3008         int8_tArray genesis_hash_arr = init_int8_tArray(32, __LINE__);
3009         memcpy(genesis_hash_arr->elems, *genesis_hash, 32);
3010         int64_t short_channel_id_conv = short_channel_id;
3011         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);
3012         void* ret_ptr = untag_ptr(ret);
3013         CHECK_ACCESS(ret_ptr);
3014         LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(ret_ptr);
3015         FREE(untag_ptr(ret));
3016         return ret_conv;
3017 }
3018 static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) {
3019         LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg;
3020         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3021 }
3022 static inline LDKAccess LDKAccess_init (JSValue o) {
3023         LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
3024         atomic_init(&calls->refcnt, 1);
3025         calls->instance_ptr = o;
3026
3027         LDKAccess ret = {
3028                 .this_arg = (void*) calls,
3029                 .get_utxo = get_utxo_LDKAccess_jcall,
3030                 .free = LDKAccess_JCalls_free,
3031         };
3032         return ret;
3033 }
3034 uint64_t  __attribute__((export_name("TS_LDKAccess_new"))) TS_LDKAccess_new(JSValue o) {
3035         LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
3036         *res_ptr = LDKAccess_init(o);
3037         return tag_ptr(res_ptr, true);
3038 }
3039 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) {
3040         void* this_arg_ptr = untag_ptr(this_arg);
3041         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3042         LDKAccess* this_arg_conv = (LDKAccess*)this_arg_ptr;
3043         unsigned char genesis_hash_arr[32];
3044         CHECK(genesis_hash->arr_len == 32);
3045         memcpy(genesis_hash_arr, genesis_hash->elems, 32); FREE(genesis_hash);
3046         unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
3047         LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
3048         *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
3049         return tag_ptr(ret_conv, true);
3050 }
3051
3052 uint32_t __attribute__((export_name("TS_LDKCOption_AccessZ_ty_from_ptr"))) TS_LDKCOption_AccessZ_ty_from_ptr(uint64_t ptr) {
3053         LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)untag_ptr(ptr);
3054         switch(obj->tag) {
3055                 case LDKCOption_AccessZ_Some: return 0;
3056                 case LDKCOption_AccessZ_None: return 1;
3057                 default: abort();
3058         }
3059 }
3060 uint64_t __attribute__((export_name("TS_LDKCOption_AccessZ_Some_get_some"))) TS_LDKCOption_AccessZ_Some_get_some(uint64_t ptr) {
3061         LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)untag_ptr(ptr);
3062         assert(obj->tag == LDKCOption_AccessZ_Some);
3063                         LDKAccess* some_ret = MALLOC(sizeof(LDKAccess), "LDKAccess");
3064                         *some_ret = obj->some;
3065                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
3066                         if ((*some_ret).free == LDKAccess_JCalls_free) {
3067                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
3068                                 LDKAccess_JCalls_cloned(&(*some_ret));
3069                         }
3070         return tag_ptr(some_ret, true);
3071 }
3072 static inline bool CResult_boolLightningErrorZ_get_ok(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
3073 CHECK(owner->result_ok);
3074         return *owner->contents.result;
3075 }
3076 jboolean  __attribute__((export_name("TS_CResult_boolLightningErrorZ_get_ok"))) TS_CResult_boolLightningErrorZ_get_ok(uint64_t owner) {
3077         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
3078         jboolean ret_conv = CResult_boolLightningErrorZ_get_ok(owner_conv);
3079         return ret_conv;
3080 }
3081
3082 static inline struct LDKLightningError CResult_boolLightningErrorZ_get_err(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
3083         LDKLightningError ret = *owner->contents.err;
3084         ret.is_owned = false;
3085         return ret;
3086 }
3087 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_get_err"))) TS_CResult_boolLightningErrorZ_get_err(uint64_t owner) {
3088         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
3089         LDKLightningError ret_var = CResult_boolLightningErrorZ_get_err(owner_conv);
3090         uint64_t ret_ref = 0;
3091         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3092         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3093         return ret_ref;
3094 }
3095
3096 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3097         LDKChannelAnnouncement ret = owner->a;
3098         ret.is_owned = false;
3099         return ret;
3100 }
3101 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(uint64_t owner) {
3102         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
3103         LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(owner_conv);
3104         uint64_t ret_ref = 0;
3105         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3106         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3107         return ret_ref;
3108 }
3109
3110 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3111         LDKChannelUpdate ret = owner->b;
3112         ret.is_owned = false;
3113         return ret;
3114 }
3115 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(uint64_t owner) {
3116         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
3117         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(owner_conv);
3118         uint64_t ret_ref = 0;
3119         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3120         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3121         return ret_ref;
3122 }
3123
3124 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3125         LDKChannelUpdate ret = owner->c;
3126         ret.is_owned = false;
3127         return ret;
3128 }
3129 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(uint64_t owner) {
3130         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
3131         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(owner_conv);
3132         uint64_t ret_ref = 0;
3133         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3134         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3135         return ret_ref;
3136 }
3137
3138 uint32_t __attribute__((export_name("TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_ty_from_ptr"))) TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_ty_from_ptr(uint64_t ptr) {
3139         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *obj = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(ptr);
3140         switch(obj->tag) {
3141                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some: return 0;
3142                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None: return 1;
3143                 default: abort();
3144         }
3145 }
3146 uint64_t __attribute__((export_name("TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_get_some"))) TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_get_some(uint64_t ptr) {
3147         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *obj = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(ptr);
3148         assert(obj->tag == LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some);
3149                         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* some_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
3150                         *some_conv = obj->some;
3151                         *some_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(some_conv);
3152         return tag_ptr(some_conv, true);
3153 }
3154 static inline void CResult_NoneLightningErrorZ_get_ok(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
3155 CHECK(owner->result_ok);
3156         return *owner->contents.result;
3157 }
3158 void  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_get_ok"))) TS_CResult_NoneLightningErrorZ_get_ok(uint64_t owner) {
3159         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
3160         CResult_NoneLightningErrorZ_get_ok(owner_conv);
3161 }
3162
3163 static inline struct LDKLightningError CResult_NoneLightningErrorZ_get_err(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
3164         LDKLightningError ret = *owner->contents.err;
3165         ret.is_owned = false;
3166         return ret;
3167 }
3168 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_get_err"))) TS_CResult_NoneLightningErrorZ_get_err(uint64_t owner) {
3169         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
3170         LDKLightningError ret_var = CResult_NoneLightningErrorZ_get_err(owner_conv);
3171         uint64_t ret_ref = 0;
3172         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3173         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3174         return ret_ref;
3175 }
3176
3177 static inline struct LDKChannelUpdateInfo CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
3178         LDKChannelUpdateInfo ret = *owner->contents.result;
3179         ret.is_owned = false;
3180         return ret;
3181 }
3182 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(uint64_t owner) {
3183         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
3184         LDKChannelUpdateInfo ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(owner_conv);
3185         uint64_t ret_ref = 0;
3186         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3187         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3188         return ret_ref;
3189 }
3190
3191 static inline struct LDKDecodeError CResult_ChannelUpdateInfoDecodeErrorZ_get_err(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
3192         LDKDecodeError ret = *owner->contents.err;
3193         ret.is_owned = false;
3194         return ret;
3195 }
3196 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_err"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_err(uint64_t owner) {
3197         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
3198         LDKDecodeError ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_err(owner_conv);
3199         uint64_t ret_ref = 0;
3200         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3201         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3202         return ret_ref;
3203 }
3204
3205 static inline struct LDKChannelInfo CResult_ChannelInfoDecodeErrorZ_get_ok(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
3206         LDKChannelInfo ret = *owner->contents.result;
3207         ret.is_owned = false;
3208         return ret;
3209 }
3210 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_get_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_get_ok(uint64_t owner) {
3211         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
3212         LDKChannelInfo ret_var = CResult_ChannelInfoDecodeErrorZ_get_ok(owner_conv);
3213         uint64_t ret_ref = 0;
3214         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3215         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3216         return ret_ref;
3217 }
3218
3219 static inline struct LDKDecodeError CResult_ChannelInfoDecodeErrorZ_get_err(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
3220         LDKDecodeError ret = *owner->contents.err;
3221         ret.is_owned = false;
3222         return ret;
3223 }
3224 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_get_err"))) TS_CResult_ChannelInfoDecodeErrorZ_get_err(uint64_t owner) {
3225         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
3226         LDKDecodeError ret_var = CResult_ChannelInfoDecodeErrorZ_get_err(owner_conv);
3227         uint64_t ret_ref = 0;
3228         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3229         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3230         return ret_ref;
3231 }
3232
3233 static inline struct LDKRoutingFees CResult_RoutingFeesDecodeErrorZ_get_ok(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
3234         LDKRoutingFees ret = *owner->contents.result;
3235         ret.is_owned = false;
3236         return ret;
3237 }
3238 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_get_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_get_ok(uint64_t owner) {
3239         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
3240         LDKRoutingFees ret_var = CResult_RoutingFeesDecodeErrorZ_get_ok(owner_conv);
3241         uint64_t ret_ref = 0;
3242         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3243         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3244         return ret_ref;
3245 }
3246
3247 static inline struct LDKDecodeError CResult_RoutingFeesDecodeErrorZ_get_err(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
3248         LDKDecodeError ret = *owner->contents.err;
3249         ret.is_owned = false;
3250         return ret;
3251 }
3252 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_get_err"))) TS_CResult_RoutingFeesDecodeErrorZ_get_err(uint64_t owner) {
3253         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
3254         LDKDecodeError ret_var = CResult_RoutingFeesDecodeErrorZ_get_err(owner_conv);
3255         uint64_t ret_ref = 0;
3256         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3257         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3258         return ret_ref;
3259 }
3260
3261 uint32_t __attribute__((export_name("TS_LDKNetAddress_ty_from_ptr"))) TS_LDKNetAddress_ty_from_ptr(uint64_t ptr) {
3262         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3263         switch(obj->tag) {
3264                 case LDKNetAddress_IPv4: return 0;
3265                 case LDKNetAddress_IPv6: return 1;
3266                 case LDKNetAddress_OnionV2: return 2;
3267                 case LDKNetAddress_OnionV3: return 3;
3268                 case LDKNetAddress_Hostname: return 4;
3269                 default: abort();
3270         }
3271 }
3272 int8_tArray __attribute__((export_name("TS_LDKNetAddress_IPv4_get_addr"))) TS_LDKNetAddress_IPv4_get_addr(uint64_t ptr) {
3273         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3274         assert(obj->tag == LDKNetAddress_IPv4);
3275                         int8_tArray addr_arr = init_int8_tArray(4, __LINE__);
3276                         memcpy(addr_arr->elems, obj->i_pv4.addr.data, 4);
3277         return addr_arr;
3278 }
3279 int16_t __attribute__((export_name("TS_LDKNetAddress_IPv4_get_port"))) TS_LDKNetAddress_IPv4_get_port(uint64_t ptr) {
3280         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3281         assert(obj->tag == LDKNetAddress_IPv4);
3282                         int16_t port_conv = obj->i_pv4.port;
3283         return port_conv;
3284 }
3285 int8_tArray __attribute__((export_name("TS_LDKNetAddress_IPv6_get_addr"))) TS_LDKNetAddress_IPv6_get_addr(uint64_t ptr) {
3286         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3287         assert(obj->tag == LDKNetAddress_IPv6);
3288                         int8_tArray addr_arr = init_int8_tArray(16, __LINE__);
3289                         memcpy(addr_arr->elems, obj->i_pv6.addr.data, 16);
3290         return addr_arr;
3291 }
3292 int16_t __attribute__((export_name("TS_LDKNetAddress_IPv6_get_port"))) TS_LDKNetAddress_IPv6_get_port(uint64_t ptr) {
3293         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3294         assert(obj->tag == LDKNetAddress_IPv6);
3295                         int16_t port_conv = obj->i_pv6.port;
3296         return port_conv;
3297 }
3298 int8_tArray __attribute__((export_name("TS_LDKNetAddress_OnionV2_get_onion_v2"))) TS_LDKNetAddress_OnionV2_get_onion_v2(uint64_t ptr) {
3299         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3300         assert(obj->tag == LDKNetAddress_OnionV2);
3301                         int8_tArray onion_v2_arr = init_int8_tArray(12, __LINE__);
3302                         memcpy(onion_v2_arr->elems, obj->onion_v2.data, 12);
3303         return onion_v2_arr;
3304 }
3305 int8_tArray __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_ed25519_pubkey"))) TS_LDKNetAddress_OnionV3_get_ed25519_pubkey(uint64_t ptr) {
3306         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3307         assert(obj->tag == LDKNetAddress_OnionV3);
3308                         int8_tArray ed25519_pubkey_arr = init_int8_tArray(32, __LINE__);
3309                         memcpy(ed25519_pubkey_arr->elems, obj->onion_v3.ed25519_pubkey.data, 32);
3310         return ed25519_pubkey_arr;
3311 }
3312 int16_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_checksum"))) TS_LDKNetAddress_OnionV3_get_checksum(uint64_t ptr) {
3313         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3314         assert(obj->tag == LDKNetAddress_OnionV3);
3315                         int16_t checksum_conv = obj->onion_v3.checksum;
3316         return checksum_conv;
3317 }
3318 int8_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_version"))) TS_LDKNetAddress_OnionV3_get_version(uint64_t ptr) {
3319         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3320         assert(obj->tag == LDKNetAddress_OnionV3);
3321                         int8_t version_conv = obj->onion_v3.version;
3322         return version_conv;
3323 }
3324 int16_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_port"))) TS_LDKNetAddress_OnionV3_get_port(uint64_t ptr) {
3325         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3326         assert(obj->tag == LDKNetAddress_OnionV3);
3327                         int16_t port_conv = obj->onion_v3.port;
3328         return port_conv;
3329 }
3330 uint64_t __attribute__((export_name("TS_LDKNetAddress_Hostname_get_hostname"))) TS_LDKNetAddress_Hostname_get_hostname(uint64_t ptr) {
3331         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3332         assert(obj->tag == LDKNetAddress_Hostname);
3333                         LDKHostname hostname_var = obj->hostname.hostname;
3334                         uint64_t hostname_ref = 0;
3335                         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_var);
3336                         hostname_ref = tag_ptr(hostname_var.inner, false);
3337         return hostname_ref;
3338 }
3339 int16_t __attribute__((export_name("TS_LDKNetAddress_Hostname_get_port"))) TS_LDKNetAddress_Hostname_get_port(uint64_t ptr) {
3340         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3341         assert(obj->tag == LDKNetAddress_Hostname);
3342                         int16_t port_conv = obj->hostname.port;
3343         return port_conv;
3344 }
3345 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
3346         LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
3347         for (size_t i = 0; i < ret.datalen; i++) {
3348                 ret.data[i] = NetAddress_clone(&orig->data[i]);
3349         }
3350         return ret;
3351 }
3352 static inline struct LDKNodeAnnouncementInfo CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
3353         LDKNodeAnnouncementInfo ret = *owner->contents.result;
3354         ret.is_owned = false;
3355         return ret;
3356 }
3357 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(uint64_t owner) {
3358         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
3359         LDKNodeAnnouncementInfo ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(owner_conv);
3360         uint64_t ret_ref = 0;
3361         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3362         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3363         return ret_ref;
3364 }
3365
3366 static inline struct LDKDecodeError CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
3367         LDKDecodeError ret = *owner->contents.err;
3368         ret.is_owned = false;
3369         return ret;
3370 }
3371 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(uint64_t owner) {
3372         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
3373         LDKDecodeError ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(owner_conv);
3374         uint64_t ret_ref = 0;
3375         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3376         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3377         return ret_ref;
3378 }
3379
3380 static inline struct LDKNodeAlias CResult_NodeAliasDecodeErrorZ_get_ok(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
3381         LDKNodeAlias ret = *owner->contents.result;
3382         ret.is_owned = false;
3383         return ret;
3384 }
3385 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_get_ok"))) TS_CResult_NodeAliasDecodeErrorZ_get_ok(uint64_t owner) {
3386         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
3387         LDKNodeAlias ret_var = CResult_NodeAliasDecodeErrorZ_get_ok(owner_conv);
3388         uint64_t ret_ref = 0;
3389         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3390         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3391         return ret_ref;
3392 }
3393
3394 static inline struct LDKDecodeError CResult_NodeAliasDecodeErrorZ_get_err(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
3395         LDKDecodeError ret = *owner->contents.err;
3396         ret.is_owned = false;
3397         return ret;
3398 }
3399 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_get_err"))) TS_CResult_NodeAliasDecodeErrorZ_get_err(uint64_t owner) {
3400         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
3401         LDKDecodeError ret_var = CResult_NodeAliasDecodeErrorZ_get_err(owner_conv);
3402         uint64_t ret_ref = 0;
3403         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3404         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3405         return ret_ref;
3406 }
3407
3408 static inline struct LDKNodeInfo CResult_NodeInfoDecodeErrorZ_get_ok(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
3409         LDKNodeInfo ret = *owner->contents.result;
3410         ret.is_owned = false;
3411         return ret;
3412 }
3413 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_get_ok"))) TS_CResult_NodeInfoDecodeErrorZ_get_ok(uint64_t owner) {
3414         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
3415         LDKNodeInfo ret_var = CResult_NodeInfoDecodeErrorZ_get_ok(owner_conv);
3416         uint64_t ret_ref = 0;
3417         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3418         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3419         return ret_ref;
3420 }
3421
3422 static inline struct LDKDecodeError CResult_NodeInfoDecodeErrorZ_get_err(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
3423         LDKDecodeError ret = *owner->contents.err;
3424         ret.is_owned = false;
3425         return ret;
3426 }
3427 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_get_err"))) TS_CResult_NodeInfoDecodeErrorZ_get_err(uint64_t owner) {
3428         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
3429         LDKDecodeError ret_var = CResult_NodeInfoDecodeErrorZ_get_err(owner_conv);
3430         uint64_t ret_ref = 0;
3431         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3432         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3433         return ret_ref;
3434 }
3435
3436 static inline struct LDKNetworkGraph CResult_NetworkGraphDecodeErrorZ_get_ok(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
3437         LDKNetworkGraph ret = *owner->contents.result;
3438         ret.is_owned = false;
3439         return ret;
3440 }
3441 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_get_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_get_ok(uint64_t owner) {
3442         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
3443         LDKNetworkGraph ret_var = CResult_NetworkGraphDecodeErrorZ_get_ok(owner_conv);
3444         uint64_t ret_ref = 0;
3445         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3446         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3447         return ret_ref;
3448 }
3449
3450 static inline struct LDKDecodeError CResult_NetworkGraphDecodeErrorZ_get_err(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
3451         LDKDecodeError ret = *owner->contents.err;
3452         ret.is_owned = false;
3453         return ret;
3454 }
3455 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_get_err"))) TS_CResult_NetworkGraphDecodeErrorZ_get_err(uint64_t owner) {
3456         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
3457         LDKDecodeError ret_var = CResult_NetworkGraphDecodeErrorZ_get_err(owner_conv);
3458         uint64_t ret_ref = 0;
3459         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3460         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3461         return ret_ref;
3462 }
3463
3464 uint32_t __attribute__((export_name("TS_LDKCOption_CVec_NetAddressZZ_ty_from_ptr"))) TS_LDKCOption_CVec_NetAddressZZ_ty_from_ptr(uint64_t ptr) {
3465         LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(ptr);
3466         switch(obj->tag) {
3467                 case LDKCOption_CVec_NetAddressZZ_Some: return 0;
3468                 case LDKCOption_CVec_NetAddressZZ_None: return 1;
3469                 default: abort();
3470         }
3471 }
3472 uint64_tArray __attribute__((export_name("TS_LDKCOption_CVec_NetAddressZZ_Some_get_some"))) TS_LDKCOption_CVec_NetAddressZZ_Some_get_some(uint64_t ptr) {
3473         LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(ptr);
3474         assert(obj->tag == LDKCOption_CVec_NetAddressZZ_Some);
3475                         LDKCVec_NetAddressZ some_var = obj->some;
3476                         uint64_tArray some_arr = NULL;
3477                         some_arr = init_uint64_tArray(some_var.datalen, __LINE__);
3478                         uint64_t *some_arr_ptr = (uint64_t*)(((uint8_t*)some_arr) + 8);
3479                         for (size_t m = 0; m < some_var.datalen; m++) {
3480                                 uint64_t some_conv_12_ref = tag_ptr(&some_var.data[m], false);
3481                                 some_arr_ptr[m] = some_conv_12_ref;
3482                         }
3483                         
3484         return some_arr;
3485 }
3486 static inline struct LDKDelayedPaymentOutputDescriptor CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3487         LDKDelayedPaymentOutputDescriptor ret = *owner->contents.result;
3488         ret.is_owned = false;
3489         return ret;
3490 }
3491 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
3492         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
3493         LDKDelayedPaymentOutputDescriptor ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
3494         uint64_t ret_ref = 0;
3495         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3496         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3497         return ret_ref;
3498 }
3499
3500 static inline struct LDKDecodeError CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3501         LDKDecodeError ret = *owner->contents.err;
3502         ret.is_owned = false;
3503         return ret;
3504 }
3505 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
3506         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
3507         LDKDecodeError ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
3508         uint64_t ret_ref = 0;
3509         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3510         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3511         return ret_ref;
3512 }
3513
3514 static inline struct LDKStaticPaymentOutputDescriptor CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3515         LDKStaticPaymentOutputDescriptor ret = *owner->contents.result;
3516         ret.is_owned = false;
3517         return ret;
3518 }
3519 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
3520         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
3521         LDKStaticPaymentOutputDescriptor ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
3522         uint64_t ret_ref = 0;
3523         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3524         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3525         return ret_ref;
3526 }
3527
3528 static inline struct LDKDecodeError CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3529         LDKDecodeError ret = *owner->contents.err;
3530         ret.is_owned = false;
3531         return ret;
3532 }
3533 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
3534         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
3535         LDKDecodeError ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
3536         uint64_t ret_ref = 0;
3537         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3538         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3539         return ret_ref;
3540 }
3541
3542 static inline struct LDKSpendableOutputDescriptor CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3543 CHECK(owner->result_ok);
3544         return SpendableOutputDescriptor_clone(&*owner->contents.result);
3545 }
3546 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
3547         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
3548         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
3549         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
3550         uint64_t ret_ref = tag_ptr(ret_copy, true);
3551         return ret_ref;
3552 }
3553
3554 static inline struct LDKDecodeError CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3555         LDKDecodeError ret = *owner->contents.err;
3556         ret.is_owned = false;
3557         return ret;
3558 }
3559 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
3560         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
3561         LDKDecodeError ret_var = CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(owner_conv);
3562         uint64_t ret_ref = 0;
3563         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3564         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3565         return ret_ref;
3566 }
3567
3568 static inline LDKCVec_PaymentPreimageZ CVec_PaymentPreimageZ_clone(const LDKCVec_PaymentPreimageZ *orig) {
3569         LDKCVec_PaymentPreimageZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_PaymentPreimageZ clone bytes"), .datalen = orig->datalen };
3570         for (size_t i = 0; i < ret.datalen; i++) {
3571                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
3572         }
3573         return ret;
3574 }
3575 static inline struct LDKSignature C2Tuple_SignatureCVec_SignatureZZ_get_a(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
3576         return owner->a;
3577 }
3578 int8_tArray  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_get_a"))) TS_C2Tuple_SignatureCVec_SignatureZZ_get_a(uint64_t owner) {
3579         LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(owner);
3580         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
3581         memcpy(ret_arr->elems, C2Tuple_SignatureCVec_SignatureZZ_get_a(owner_conv).compact_form, 64);
3582         return ret_arr;
3583 }
3584
3585 static inline struct LDKCVec_SignatureZ C2Tuple_SignatureCVec_SignatureZZ_get_b(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
3586         return owner->b;
3587 }
3588 ptrArray  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_get_b"))) TS_C2Tuple_SignatureCVec_SignatureZZ_get_b(uint64_t owner) {
3589         LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(owner);
3590         LDKCVec_SignatureZ ret_var = C2Tuple_SignatureCVec_SignatureZZ_get_b(owner_conv);
3591         ptrArray ret_arr = NULL;
3592         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
3593         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
3594         for (size_t m = 0; m < ret_var.datalen; m++) {
3595                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
3596                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
3597                 ret_arr_ptr[m] = ret_conv_12_arr;
3598         }
3599         
3600         return ret_arr;
3601 }
3602
3603 static inline struct LDKC2Tuple_SignatureCVec_SignatureZZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
3604 CHECK(owner->result_ok);
3605         return C2Tuple_SignatureCVec_SignatureZZ_clone(&*owner->contents.result);
3606 }
3607 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(uint64_t owner) {
3608         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(owner);
3609         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
3610         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(owner_conv);
3611         return tag_ptr(ret_conv, true);
3612 }
3613
3614 static inline void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
3615 CHECK(!owner->result_ok);
3616         return *owner->contents.err;
3617 }
3618 void  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(uint64_t owner) {
3619         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(owner);
3620         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(owner_conv);
3621 }
3622
3623 static inline struct LDKSignature CResult_SignatureNoneZ_get_ok(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
3624 CHECK(owner->result_ok);
3625         return *owner->contents.result;
3626 }
3627 int8_tArray  __attribute__((export_name("TS_CResult_SignatureNoneZ_get_ok"))) TS_CResult_SignatureNoneZ_get_ok(uint64_t owner) {
3628         LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(owner);
3629         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
3630         memcpy(ret_arr->elems, CResult_SignatureNoneZ_get_ok(owner_conv).compact_form, 64);
3631         return ret_arr;
3632 }
3633
3634 static inline void CResult_SignatureNoneZ_get_err(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
3635 CHECK(!owner->result_ok);
3636         return *owner->contents.err;
3637 }
3638 void  __attribute__((export_name("TS_CResult_SignatureNoneZ_get_err"))) TS_CResult_SignatureNoneZ_get_err(uint64_t owner) {
3639         LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(owner);
3640         CResult_SignatureNoneZ_get_err(owner_conv);
3641 }
3642
3643 static inline struct LDKSignature C2Tuple_SignatureSignatureZ_get_a(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR owner){
3644         return owner->a;
3645 }
3646 int8_tArray  __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_get_a"))) TS_C2Tuple_SignatureSignatureZ_get_a(uint64_t owner) {
3647         LDKC2Tuple_SignatureSignatureZ* owner_conv = (LDKC2Tuple_SignatureSignatureZ*)untag_ptr(owner);
3648         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
3649         memcpy(ret_arr->elems, C2Tuple_SignatureSignatureZ_get_a(owner_conv).compact_form, 64);
3650         return ret_arr;
3651 }
3652
3653 static inline struct LDKSignature C2Tuple_SignatureSignatureZ_get_b(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR owner){
3654         return owner->b;
3655 }
3656 int8_tArray  __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_get_b"))) TS_C2Tuple_SignatureSignatureZ_get_b(uint64_t owner) {
3657         LDKC2Tuple_SignatureSignatureZ* owner_conv = (LDKC2Tuple_SignatureSignatureZ*)untag_ptr(owner);
3658         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
3659         memcpy(ret_arr->elems, C2Tuple_SignatureSignatureZ_get_b(owner_conv).compact_form, 64);
3660         return ret_arr;
3661 }
3662
3663 static inline struct LDKC2Tuple_SignatureSignatureZ CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR owner){
3664 CHECK(owner->result_ok);
3665         return C2Tuple_SignatureSignatureZ_clone(&*owner->contents.result);
3666 }
3667 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(uint64_t owner) {
3668         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(owner);
3669         LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
3670         *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(owner_conv);
3671         return tag_ptr(ret_conv, true);
3672 }
3673
3674 static inline void CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR owner){
3675 CHECK(!owner->result_ok);
3676         return *owner->contents.err;
3677 }
3678 void  __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_get_err"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(uint64_t owner) {
3679         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(owner);
3680         CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(owner_conv);
3681 }
3682
3683 static inline struct LDKSecretKey CResult_SecretKeyNoneZ_get_ok(LDKCResult_SecretKeyNoneZ *NONNULL_PTR owner){
3684 CHECK(owner->result_ok);
3685         return *owner->contents.result;
3686 }
3687 int8_tArray  __attribute__((export_name("TS_CResult_SecretKeyNoneZ_get_ok"))) TS_CResult_SecretKeyNoneZ_get_ok(uint64_t owner) {
3688         LDKCResult_SecretKeyNoneZ* owner_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(owner);
3689         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
3690         memcpy(ret_arr->elems, CResult_SecretKeyNoneZ_get_ok(owner_conv).bytes, 32);
3691         return ret_arr;
3692 }
3693
3694 static inline void CResult_SecretKeyNoneZ_get_err(LDKCResult_SecretKeyNoneZ *NONNULL_PTR owner){
3695 CHECK(!owner->result_ok);
3696         return *owner->contents.err;
3697 }
3698 void  __attribute__((export_name("TS_CResult_SecretKeyNoneZ_get_err"))) TS_CResult_SecretKeyNoneZ_get_err(uint64_t owner) {
3699         LDKCResult_SecretKeyNoneZ* owner_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(owner);
3700         CResult_SecretKeyNoneZ_get_err(owner_conv);
3701 }
3702
3703 uint32_t __attribute__((export_name("TS_LDKCOption_ScalarZ_ty_from_ptr"))) TS_LDKCOption_ScalarZ_ty_from_ptr(uint64_t ptr) {
3704         LDKCOption_ScalarZ *obj = (LDKCOption_ScalarZ*)untag_ptr(ptr);
3705         switch(obj->tag) {
3706                 case LDKCOption_ScalarZ_Some: return 0;
3707                 case LDKCOption_ScalarZ_None: return 1;
3708                 default: abort();
3709         }
3710 }
3711 uint64_t __attribute__((export_name("TS_LDKCOption_ScalarZ_Some_get_some"))) TS_LDKCOption_ScalarZ_Some_get_some(uint64_t ptr) {
3712         LDKCOption_ScalarZ *obj = (LDKCOption_ScalarZ*)untag_ptr(ptr);
3713         assert(obj->tag == LDKCOption_ScalarZ_Some);
3714                         LDKBigEndianScalar* some_ref = &obj->some;
3715         return tag_ptr(some_ref, false);
3716 }
3717 static inline struct LDKThirtyTwoBytes CResult_SharedSecretNoneZ_get_ok(LDKCResult_SharedSecretNoneZ *NONNULL_PTR owner){
3718 CHECK(owner->result_ok);
3719         return ThirtyTwoBytes_clone(&*owner->contents.result);
3720 }
3721 int8_tArray  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_get_ok"))) TS_CResult_SharedSecretNoneZ_get_ok(uint64_t owner) {
3722         LDKCResult_SharedSecretNoneZ* owner_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(owner);
3723         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
3724         memcpy(ret_arr->elems, CResult_SharedSecretNoneZ_get_ok(owner_conv).data, 32);
3725         return ret_arr;
3726 }
3727
3728 static inline void CResult_SharedSecretNoneZ_get_err(LDKCResult_SharedSecretNoneZ *NONNULL_PTR owner){
3729 CHECK(!owner->result_ok);
3730         return *owner->contents.err;
3731 }
3732 void  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_get_err"))) TS_CResult_SharedSecretNoneZ_get_err(uint64_t owner) {
3733         LDKCResult_SharedSecretNoneZ* owner_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(owner);
3734         CResult_SharedSecretNoneZ_get_err(owner_conv);
3735 }
3736
3737 typedef struct LDKBaseSign_JCalls {
3738         atomic_size_t refcnt;
3739         uint32_t instance_ptr;
3740 } LDKBaseSign_JCalls;
3741 static void LDKBaseSign_JCalls_free(void* this_arg) {
3742         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3743         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3744                 FREE(j_calls);
3745         }
3746 }
3747 LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
3748         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3749         int64_t idx_conv = idx;
3750         int8_tArray ret = (int8_tArray)js_invoke_function_buuuuu(j_calls->instance_ptr, 2, idx_conv, 0, 0, 0, 0, 0);
3751         LDKPublicKey ret_ref;
3752         CHECK(ret->arr_len == 33);
3753         memcpy(ret_ref.compressed_form, ret->elems, 33); FREE(ret);
3754         return ret_ref;
3755 }
3756 LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
3757         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3758         int64_t idx_conv = idx;
3759         int8_tArray ret = (int8_tArray)js_invoke_function_buuuuu(j_calls->instance_ptr, 3, idx_conv, 0, 0, 0, 0, 0);
3760         LDKThirtyTwoBytes ret_ref;
3761         CHECK(ret->arr_len == 32);
3762         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
3763         return ret_ref;
3764 }
3765 LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx, LDKCVec_PaymentPreimageZ preimages) {
3766         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3767         LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
3768         uint64_t holder_tx_ref = 0;
3769         holder_tx_var = HolderCommitmentTransaction_clone(&holder_tx_var);
3770         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
3771         holder_tx_ref = tag_ptr(holder_tx_var.inner, holder_tx_var.is_owned);
3772         LDKCVec_PaymentPreimageZ preimages_var = preimages;
3773         ptrArray preimages_arr = NULL;
3774         preimages_arr = init_ptrArray(preimages_var.datalen, __LINE__);
3775         int8_tArray *preimages_arr_ptr = (int8_tArray*)(((uint8_t*)preimages_arr) + 8);
3776         for (size_t m = 0; m < preimages_var.datalen; m++) {
3777                 int8_tArray preimages_conv_12_arr = init_int8_tArray(32, __LINE__);
3778                 memcpy(preimages_conv_12_arr->elems, preimages_var.data[m].data, 32);
3779                 preimages_arr_ptr[m] = preimages_conv_12_arr;
3780         }
3781         
3782         FREE(preimages_var.data);
3783         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 4, holder_tx_ref, (uint32_t)preimages_arr, 0, 0, 0, 0);
3784         void* ret_ptr = untag_ptr(ret);
3785         CHECK_ACCESS(ret_ptr);
3786         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
3787         FREE(untag_ptr(ret));
3788         return ret_conv;
3789 }
3790 LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
3791         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3792         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 5, 0, 0, 0, 0, 0, 0);
3793         LDKThirtyTwoBytes ret_ref;
3794         CHECK(ret->arr_len == 32);
3795         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
3796         return ret_ref;
3797 }
3798 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx, LDKCVec_PaymentPreimageZ preimages) {
3799         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3800         LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
3801         uint64_t commitment_tx_ref = 0;
3802         commitment_tx_var = CommitmentTransaction_clone(&commitment_tx_var);
3803         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
3804         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
3805         LDKCVec_PaymentPreimageZ preimages_var = preimages;
3806         ptrArray preimages_arr = NULL;
3807         preimages_arr = init_ptrArray(preimages_var.datalen, __LINE__);
3808         int8_tArray *preimages_arr_ptr = (int8_tArray*)(((uint8_t*)preimages_arr) + 8);
3809         for (size_t m = 0; m < preimages_var.datalen; m++) {
3810                 int8_tArray preimages_conv_12_arr = init_int8_tArray(32, __LINE__);
3811                 memcpy(preimages_conv_12_arr->elems, preimages_var.data[m].data, 32);
3812                 preimages_arr_ptr[m] = preimages_conv_12_arr;
3813         }
3814         
3815         FREE(preimages_var.data);
3816         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 6, commitment_tx_ref, (uint32_t)preimages_arr, 0, 0, 0, 0);
3817         void* ret_ptr = untag_ptr(ret);
3818         CHECK_ACCESS(ret_ptr);
3819         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
3820         FREE(untag_ptr(ret));
3821         return ret_conv;
3822 }
3823 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKBaseSign_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
3824         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3825         int64_t idx_conv = idx;
3826         int8_tArray secret_arr = init_int8_tArray(32, __LINE__);
3827         memcpy(secret_arr->elems, *secret, 32);
3828         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 7, idx_conv, (uint32_t)secret_arr, 0, 0, 0, 0);
3829         void* ret_ptr = untag_ptr(ret);
3830         CHECK_ACCESS(ret_ptr);
3831         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
3832         FREE(untag_ptr(ret));
3833         return ret_conv;
3834 }
3835 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
3836         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3837         LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
3838         uint64_t commitment_tx_ref = 0;
3839         commitment_tx_var = HolderCommitmentTransaction_clone(&commitment_tx_var);
3840         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
3841         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
3842         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 8, commitment_tx_ref, 0, 0, 0, 0, 0);
3843         void* ret_ptr = untag_ptr(ret);
3844         CHECK_ACCESS(ret_ptr);
3845         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
3846         FREE(untag_ptr(ret));
3847         return ret_conv;
3848 }
3849 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]) {
3850         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3851         LDKTransaction justice_tx_var = justice_tx;
3852         int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
3853         memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
3854         Transaction_free(justice_tx_var);
3855         uint32_t input_conv = input;
3856         int64_t amount_conv = amount;
3857         int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
3858         memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
3859         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);
3860         void* ret_ptr = untag_ptr(ret);
3861         CHECK_ACCESS(ret_ptr);
3862         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
3863         FREE(untag_ptr(ret));
3864         return ret_conv;
3865 }
3866 LDKCResult_SignatureNoneZ sign_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) {
3867         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3868         LDKTransaction justice_tx_var = justice_tx;
3869         int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
3870         memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
3871         Transaction_free(justice_tx_var);
3872         uint32_t input_conv = input;
3873         int64_t amount_conv = amount;
3874         int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
3875         memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
3876         LDKHTLCOutputInCommitment htlc_var = *htlc;
3877         uint64_t htlc_ref = 0;
3878         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
3879         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
3880         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
3881         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);
3882         void* ret_ptr = untag_ptr(ret);
3883         CHECK_ACCESS(ret_ptr);
3884         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
3885         FREE(untag_ptr(ret));
3886         return ret_conv;
3887 }
3888 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) {
3889         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3890         LDKTransaction htlc_tx_var = htlc_tx;
3891         int8_tArray htlc_tx_arr = init_int8_tArray(htlc_tx_var.datalen, __LINE__);
3892         memcpy(htlc_tx_arr->elems, htlc_tx_var.data, htlc_tx_var.datalen);
3893         Transaction_free(htlc_tx_var);
3894         uint32_t input_conv = input;
3895         int64_t amount_conv = amount;
3896         int8_tArray per_commitment_point_arr = init_int8_tArray(33, __LINE__);
3897         memcpy(per_commitment_point_arr->elems, per_commitment_point.compressed_form, 33);
3898         LDKHTLCOutputInCommitment htlc_var = *htlc;
3899         uint64_t htlc_ref = 0;
3900         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
3901         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
3902         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
3903         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);
3904         void* ret_ptr = untag_ptr(ret);
3905         CHECK_ACCESS(ret_ptr);
3906         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
3907         FREE(untag_ptr(ret));
3908         return ret_conv;
3909 }
3910 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
3911         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3912         LDKClosingTransaction closing_tx_var = *closing_tx;
3913         uint64_t closing_tx_ref = 0;
3914         closing_tx_var = ClosingTransaction_clone(&closing_tx_var);
3915         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
3916         closing_tx_ref = tag_ptr(closing_tx_var.inner, closing_tx_var.is_owned);
3917         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 12, closing_tx_ref, 0, 0, 0, 0, 0);
3918         void* ret_ptr = untag_ptr(ret);
3919         CHECK_ACCESS(ret_ptr);
3920         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
3921         FREE(untag_ptr(ret));
3922         return ret_conv;
3923 }
3924 LDKCResult_C2Tuple_SignatureSignatureZNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
3925         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3926         LDKUnsignedChannelAnnouncement msg_var = *msg;
3927         uint64_t msg_ref = 0;
3928         msg_var = UnsignedChannelAnnouncement_clone(&msg_var);
3929         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3930         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
3931         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 13, msg_ref, 0, 0, 0, 0, 0);
3932         void* ret_ptr = untag_ptr(ret);
3933         CHECK_ACCESS(ret_ptr);
3934         LDKCResult_C2Tuple_SignatureSignatureZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(ret_ptr);
3935         FREE(untag_ptr(ret));
3936         return ret_conv;
3937 }
3938 void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
3939         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3940         LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
3941         uint64_t channel_parameters_ref = 0;
3942         channel_parameters_var = ChannelTransactionParameters_clone(&channel_parameters_var);
3943         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
3944         channel_parameters_ref = tag_ptr(channel_parameters_var.inner, channel_parameters_var.is_owned);
3945         js_invoke_function_buuuuu(j_calls->instance_ptr, 14, channel_parameters_ref, 0, 0, 0, 0, 0);
3946 }
3947 static void LDKBaseSign_JCalls_cloned(LDKBaseSign* new_obj) {
3948         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) new_obj->this_arg;
3949         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3950 }
3951 static inline LDKBaseSign LDKBaseSign_init (JSValue o, uint64_t pubkeys) {
3952         LDKBaseSign_JCalls *calls = MALLOC(sizeof(LDKBaseSign_JCalls), "LDKBaseSign_JCalls");
3953         atomic_init(&calls->refcnt, 1);
3954         calls->instance_ptr = o;
3955
3956         LDKChannelPublicKeys pubkeys_conv;
3957         pubkeys_conv.inner = untag_ptr(pubkeys);
3958         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
3959         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
3960
3961         LDKBaseSign ret = {
3962                 .this_arg = (void*) calls,
3963                 .get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
3964                 .release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
3965                 .validate_holder_commitment = validate_holder_commitment_LDKBaseSign_jcall,
3966                 .channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
3967                 .sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
3968                 .validate_counterparty_revocation = validate_counterparty_revocation_LDKBaseSign_jcall,
3969                 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
3970                 .sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall,
3971                 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall,
3972                 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKBaseSign_jcall,
3973                 .sign_closing_transaction = sign_closing_transaction_LDKBaseSign_jcall,
3974                 .sign_channel_announcement = sign_channel_announcement_LDKBaseSign_jcall,
3975                 .ready_channel = ready_channel_LDKBaseSign_jcall,
3976                 .free = LDKBaseSign_JCalls_free,
3977                 .pubkeys = pubkeys_conv,
3978                 .set_pubkeys = NULL,
3979         };
3980         return ret;
3981 }
3982 uint64_t  __attribute__((export_name("TS_LDKBaseSign_new"))) TS_LDKBaseSign_new(JSValue o, uint64_t pubkeys) {
3983         LDKBaseSign *res_ptr = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
3984         *res_ptr = LDKBaseSign_init(o, pubkeys);
3985         return tag_ptr(res_ptr, true);
3986 }
3987 int8_tArray  __attribute__((export_name("TS_BaseSign_get_per_commitment_point"))) TS_BaseSign_get_per_commitment_point(uint64_t this_arg, int64_t idx) {
3988         void* this_arg_ptr = untag_ptr(this_arg);
3989         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3990         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3991         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
3992         memcpy(ret_arr->elems, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33);
3993         return ret_arr;
3994 }
3995
3996 int8_tArray  __attribute__((export_name("TS_BaseSign_release_commitment_secret"))) TS_BaseSign_release_commitment_secret(uint64_t this_arg, int64_t idx) {
3997         void* this_arg_ptr = untag_ptr(this_arg);
3998         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3999         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4000         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4001         memcpy(ret_arr->elems, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32);
4002         return ret_arr;
4003 }
4004
4005 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) {
4006         void* this_arg_ptr = untag_ptr(this_arg);
4007         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4008         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4009         LDKHolderCommitmentTransaction holder_tx_conv;
4010         holder_tx_conv.inner = untag_ptr(holder_tx);
4011         holder_tx_conv.is_owned = ptr_is_owned(holder_tx);
4012         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
4013         holder_tx_conv.is_owned = false;
4014         LDKCVec_PaymentPreimageZ preimages_constr;
4015         preimages_constr.datalen = preimages->arr_len;
4016         if (preimages_constr.datalen > 0)
4017                 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
4018         else
4019                 preimages_constr.data = NULL;
4020         int8_tArray* preimages_vals = (void*) preimages->elems;
4021         for (size_t m = 0; m < preimages_constr.datalen; m++) {
4022                 int8_tArray preimages_conv_12 = preimages_vals[m];
4023                 LDKThirtyTwoBytes preimages_conv_12_ref;
4024                 CHECK(preimages_conv_12->arr_len == 32);
4025                 memcpy(preimages_conv_12_ref.data, preimages_conv_12->elems, 32); FREE(preimages_conv_12);
4026                 preimages_constr.data[m] = preimages_conv_12_ref;
4027         }
4028         FREE(preimages);
4029         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
4030         *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, preimages_constr);
4031         return tag_ptr(ret_conv, true);
4032 }
4033
4034 int8_tArray  __attribute__((export_name("TS_BaseSign_channel_keys_id"))) TS_BaseSign_channel_keys_id(uint64_t this_arg) {
4035         void* this_arg_ptr = untag_ptr(this_arg);
4036         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4037         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4038         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4039         memcpy(ret_arr->elems, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data, 32);
4040         return ret_arr;
4041 }
4042
4043 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) {
4044         void* this_arg_ptr = untag_ptr(this_arg);
4045         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4046         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4047         LDKCommitmentTransaction commitment_tx_conv;
4048         commitment_tx_conv.inner = untag_ptr(commitment_tx);
4049         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
4050         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
4051         commitment_tx_conv.is_owned = false;
4052         LDKCVec_PaymentPreimageZ preimages_constr;
4053         preimages_constr.datalen = preimages->arr_len;
4054         if (preimages_constr.datalen > 0)
4055                 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
4056         else
4057                 preimages_constr.data = NULL;
4058         int8_tArray* preimages_vals = (void*) preimages->elems;
4059         for (size_t m = 0; m < preimages_constr.datalen; m++) {
4060                 int8_tArray preimages_conv_12 = preimages_vals[m];
4061                 LDKThirtyTwoBytes preimages_conv_12_ref;
4062                 CHECK(preimages_conv_12->arr_len == 32);
4063                 memcpy(preimages_conv_12_ref.data, preimages_conv_12->elems, 32); FREE(preimages_conv_12);
4064                 preimages_constr.data[m] = preimages_conv_12_ref;
4065         }
4066         FREE(preimages);
4067         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4068         *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv, preimages_constr);
4069         return tag_ptr(ret_conv, true);
4070 }
4071
4072 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) {
4073         void* this_arg_ptr = untag_ptr(this_arg);
4074         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4075         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4076         unsigned char secret_arr[32];
4077         CHECK(secret->arr_len == 32);
4078         memcpy(secret_arr, secret->elems, 32); FREE(secret);
4079         unsigned char (*secret_ref)[32] = &secret_arr;
4080         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
4081         *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
4082         return tag_ptr(ret_conv, true);
4083 }
4084
4085 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) {
4086         void* this_arg_ptr = untag_ptr(this_arg);
4087         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4088         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4089         LDKHolderCommitmentTransaction commitment_tx_conv;
4090         commitment_tx_conv.inner = untag_ptr(commitment_tx);
4091         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
4092         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
4093         commitment_tx_conv.is_owned = false;
4094         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4095         *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
4096         return tag_ptr(ret_conv, true);
4097 }
4098
4099 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) {
4100         void* this_arg_ptr = untag_ptr(this_arg);
4101         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4102         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4103         LDKTransaction justice_tx_ref;
4104         justice_tx_ref.datalen = justice_tx->arr_len;
4105         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
4106         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
4107         justice_tx_ref.data_is_owned = true;
4108         unsigned char per_commitment_key_arr[32];
4109         CHECK(per_commitment_key->arr_len == 32);
4110         memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key);
4111         unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
4112         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4113         *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
4114         return tag_ptr(ret_conv, true);
4115 }
4116
4117 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) {
4118         void* this_arg_ptr = untag_ptr(this_arg);
4119         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4120         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4121         LDKTransaction justice_tx_ref;
4122         justice_tx_ref.datalen = justice_tx->arr_len;
4123         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
4124         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
4125         justice_tx_ref.data_is_owned = true;
4126         unsigned char per_commitment_key_arr[32];
4127         CHECK(per_commitment_key->arr_len == 32);
4128         memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key);
4129         unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
4130         LDKHTLCOutputInCommitment htlc_conv;
4131         htlc_conv.inner = untag_ptr(htlc);
4132         htlc_conv.is_owned = ptr_is_owned(htlc);
4133         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
4134         htlc_conv.is_owned = false;
4135         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4136         *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);
4137         return tag_ptr(ret_conv, true);
4138 }
4139
4140 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) {
4141         void* this_arg_ptr = untag_ptr(this_arg);
4142         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4143         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4144         LDKTransaction htlc_tx_ref;
4145         htlc_tx_ref.datalen = htlc_tx->arr_len;
4146         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
4147         memcpy(htlc_tx_ref.data, htlc_tx->elems, htlc_tx_ref.datalen); FREE(htlc_tx);
4148         htlc_tx_ref.data_is_owned = true;
4149         LDKPublicKey per_commitment_point_ref;
4150         CHECK(per_commitment_point->arr_len == 33);
4151         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
4152         LDKHTLCOutputInCommitment htlc_conv;
4153         htlc_conv.inner = untag_ptr(htlc);
4154         htlc_conv.is_owned = ptr_is_owned(htlc);
4155         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
4156         htlc_conv.is_owned = false;
4157         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4158         *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);
4159         return tag_ptr(ret_conv, true);
4160 }
4161
4162 uint64_t  __attribute__((export_name("TS_BaseSign_sign_closing_transaction"))) TS_BaseSign_sign_closing_transaction(uint64_t this_arg, uint64_t closing_tx) {
4163         void* this_arg_ptr = untag_ptr(this_arg);
4164         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4165         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4166         LDKClosingTransaction closing_tx_conv;
4167         closing_tx_conv.inner = untag_ptr(closing_tx);
4168         closing_tx_conv.is_owned = ptr_is_owned(closing_tx);
4169         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
4170         closing_tx_conv.is_owned = false;
4171         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4172         *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
4173         return tag_ptr(ret_conv, true);
4174 }
4175
4176 uint64_t  __attribute__((export_name("TS_BaseSign_sign_channel_announcement"))) TS_BaseSign_sign_channel_announcement(uint64_t this_arg, uint64_t msg) {
4177         void* this_arg_ptr = untag_ptr(this_arg);
4178         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4179         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4180         LDKUnsignedChannelAnnouncement msg_conv;
4181         msg_conv.inner = untag_ptr(msg);
4182         msg_conv.is_owned = ptr_is_owned(msg);
4183         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
4184         msg_conv.is_owned = false;
4185         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
4186         *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
4187         return tag_ptr(ret_conv, true);
4188 }
4189
4190 void  __attribute__((export_name("TS_BaseSign_ready_channel"))) TS_BaseSign_ready_channel(uint64_t this_arg, uint64_t channel_parameters) {
4191         void* this_arg_ptr = untag_ptr(this_arg);
4192         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4193         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4194         LDKChannelTransactionParameters channel_parameters_conv;
4195         channel_parameters_conv.inner = untag_ptr(channel_parameters);
4196         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
4197         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
4198         channel_parameters_conv.is_owned = false;
4199         (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
4200 }
4201
4202 LDKChannelPublicKeys LDKBaseSign_set_get_pubkeys(LDKBaseSign* this_arg) {
4203         if (this_arg->set_pubkeys != NULL)
4204                 this_arg->set_pubkeys(this_arg);
4205         return this_arg->pubkeys;
4206 }
4207 uint64_t  __attribute__((export_name("TS_BaseSign_get_pubkeys"))) TS_BaseSign_get_pubkeys(uint64_t this_arg) {
4208         void* this_arg_ptr = untag_ptr(this_arg);
4209         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4210         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4211         LDKChannelPublicKeys ret_var = LDKBaseSign_set_get_pubkeys(this_arg_conv);
4212         uint64_t ret_ref = 0;
4213         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4214         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4215         return ret_ref;
4216 }
4217
4218 typedef struct LDKSign_JCalls {
4219         atomic_size_t refcnt;
4220         uint32_t instance_ptr;
4221         LDKBaseSign_JCalls* BaseSign;
4222 } LDKSign_JCalls;
4223 static void LDKSign_JCalls_free(void* this_arg) {
4224         LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
4225         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4226                 FREE(j_calls);
4227         }
4228 }
4229 LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
4230         LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
4231         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 15, 0, 0, 0, 0, 0, 0);
4232         LDKCVec_u8Z ret_ref;
4233         ret_ref.datalen = ret->arr_len;
4234         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
4235         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
4236         return ret_ref;
4237 }
4238 static void LDKSign_JCalls_cloned(LDKSign* new_obj) {
4239         LDKSign_JCalls *j_calls = (LDKSign_JCalls*) new_obj->this_arg;
4240         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4241         atomic_fetch_add_explicit(&j_calls->BaseSign->refcnt, 1, memory_order_release);
4242 }
4243 static inline LDKSign LDKSign_init (JSValue o, JSValue BaseSign, uint64_t pubkeys) {
4244         LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
4245         atomic_init(&calls->refcnt, 1);
4246         calls->instance_ptr = o;
4247
4248         LDKChannelPublicKeys pubkeys_conv;
4249         pubkeys_conv.inner = untag_ptr(pubkeys);
4250         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
4251         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
4252
4253         LDKSign ret = {
4254                 .this_arg = (void*) calls,
4255                 .write = write_LDKSign_jcall,
4256                 .cloned = LDKSign_JCalls_cloned,
4257                 .free = LDKSign_JCalls_free,
4258                 .BaseSign = LDKBaseSign_init(BaseSign, pubkeys),
4259         };
4260         calls->BaseSign = ret.BaseSign.this_arg;
4261         return ret;
4262 }
4263 uint64_t  __attribute__((export_name("TS_LDKSign_new"))) TS_LDKSign_new(JSValue o, JSValue BaseSign, uint64_t pubkeys) {
4264         LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
4265         *res_ptr = LDKSign_init(o, BaseSign, pubkeys);
4266         return tag_ptr(res_ptr, true);
4267 }
4268 int8_tArray  __attribute__((export_name("TS_Sign_write"))) TS_Sign_write(uint64_t this_arg) {
4269         void* this_arg_ptr = untag_ptr(this_arg);
4270         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4271         LDKSign* this_arg_conv = (LDKSign*)this_arg_ptr;
4272         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
4273         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
4274         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
4275         CVec_u8Z_free(ret_var);
4276         return ret_arr;
4277 }
4278
4279 static inline struct LDKSign CResult_SignDecodeErrorZ_get_ok(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){
4280 CHECK(owner->result_ok);
4281         return Sign_clone(&*owner->contents.result);
4282 }
4283 uint64_t  __attribute__((export_name("TS_CResult_SignDecodeErrorZ_get_ok"))) TS_CResult_SignDecodeErrorZ_get_ok(uint64_t owner) {
4284         LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(owner);
4285         LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
4286         *ret_ret = CResult_SignDecodeErrorZ_get_ok(owner_conv);
4287         return tag_ptr(ret_ret, true);
4288 }
4289
4290 static inline struct LDKDecodeError CResult_SignDecodeErrorZ_get_err(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){
4291         LDKDecodeError ret = *owner->contents.err;
4292         ret.is_owned = false;
4293         return ret;
4294 }
4295 uint64_t  __attribute__((export_name("TS_CResult_SignDecodeErrorZ_get_err"))) TS_CResult_SignDecodeErrorZ_get_err(uint64_t owner) {
4296         LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(owner);
4297         LDKDecodeError ret_var = CResult_SignDecodeErrorZ_get_err(owner_conv);
4298         uint64_t ret_ref = 0;
4299         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4300         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4301         return ret_ref;
4302 }
4303
4304 static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
4305 CHECK(owner->result_ok);
4306         return *owner->contents.result;
4307 }
4308 int8_tArray  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_get_ok"))) TS_CResult_RecoverableSignatureNoneZ_get_ok(uint64_t owner) {
4309         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
4310         int8_tArray ret_arr = init_int8_tArray(68, __LINE__);
4311         memcpy(ret_arr->elems, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form, 68);
4312         return ret_arr;
4313 }
4314
4315 static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
4316 CHECK(!owner->result_ok);
4317         return *owner->contents.err;
4318 }
4319 void  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_get_err"))) TS_CResult_RecoverableSignatureNoneZ_get_err(uint64_t owner) {
4320         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
4321         CResult_RecoverableSignatureNoneZ_get_err(owner_conv);
4322 }
4323
4324 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
4325         LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
4326         for (size_t i = 0; i < ret.datalen; i++) {
4327                 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
4328         }
4329         return ret;
4330 }
4331 static inline struct LDKCVec_CVec_u8ZZ CResult_CVec_CVec_u8ZZNoneZ_get_ok(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
4332 CHECK(owner->result_ok);
4333         return CVec_CVec_u8ZZ_clone(&*owner->contents.result);
4334 }
4335 ptrArray  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_get_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_get_ok(uint64_t owner) {
4336         LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(owner);
4337         LDKCVec_CVec_u8ZZ ret_var = CResult_CVec_CVec_u8ZZNoneZ_get_ok(owner_conv);
4338         ptrArray ret_arr = NULL;
4339         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
4340         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
4341         for (size_t m = 0; m < ret_var.datalen; m++) {
4342                 LDKCVec_u8Z ret_conv_12_var = ret_var.data[m];
4343                 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen, __LINE__);
4344                 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
4345                 CVec_u8Z_free(ret_conv_12_var);
4346                 ret_arr_ptr[m] = ret_conv_12_arr;
4347         }
4348         
4349         FREE(ret_var.data);
4350         return ret_arr;
4351 }
4352
4353 static inline void CResult_CVec_CVec_u8ZZNoneZ_get_err(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
4354 CHECK(!owner->result_ok);
4355         return *owner->contents.err;
4356 }
4357 void  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_get_err"))) TS_CResult_CVec_CVec_u8ZZNoneZ_get_err(uint64_t owner) {
4358         LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(owner);
4359         CResult_CVec_CVec_u8ZZNoneZ_get_err(owner_conv);
4360 }
4361
4362 static inline struct LDKInMemorySigner CResult_InMemorySignerDecodeErrorZ_get_ok(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
4363         LDKInMemorySigner ret = *owner->contents.result;
4364         ret.is_owned = false;
4365         return ret;
4366 }
4367 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_get_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_get_ok(uint64_t owner) {
4368         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
4369         LDKInMemorySigner ret_var = CResult_InMemorySignerDecodeErrorZ_get_ok(owner_conv);
4370         uint64_t ret_ref = 0;
4371         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4372         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4373         return ret_ref;
4374 }
4375
4376 static inline struct LDKDecodeError CResult_InMemorySignerDecodeErrorZ_get_err(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
4377         LDKDecodeError ret = *owner->contents.err;
4378         ret.is_owned = false;
4379         return ret;
4380 }
4381 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_get_err"))) TS_CResult_InMemorySignerDecodeErrorZ_get_err(uint64_t owner) {
4382         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
4383         LDKDecodeError ret_var = CResult_InMemorySignerDecodeErrorZ_get_err(owner_conv);
4384         uint64_t ret_ref = 0;
4385         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4386         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4387         return ret_ref;
4388 }
4389
4390 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
4391         LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
4392         for (size_t i = 0; i < ret.datalen; i++) {
4393                 ret.data[i] = TxOut_clone(&orig->data[i]);
4394         }
4395         return ret;
4396 }
4397 static inline struct LDKTransaction CResult_TransactionNoneZ_get_ok(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
4398 CHECK(owner->result_ok);
4399         return *owner->contents.result;
4400 }
4401 int8_tArray  __attribute__((export_name("TS_CResult_TransactionNoneZ_get_ok"))) TS_CResult_TransactionNoneZ_get_ok(uint64_t owner) {
4402         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
4403         LDKTransaction ret_var = CResult_TransactionNoneZ_get_ok(owner_conv);
4404         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
4405         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
4406         return ret_arr;
4407 }
4408
4409 static inline void CResult_TransactionNoneZ_get_err(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
4410 CHECK(!owner->result_ok);
4411         return *owner->contents.err;
4412 }
4413 void  __attribute__((export_name("TS_CResult_TransactionNoneZ_get_err"))) TS_CResult_TransactionNoneZ_get_err(uint64_t owner) {
4414         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
4415         CResult_TransactionNoneZ_get_err(owner_conv);
4416 }
4417
4418 uint32_t __attribute__((export_name("TS_LDKCOption_u16Z_ty_from_ptr"))) TS_LDKCOption_u16Z_ty_from_ptr(uint64_t ptr) {
4419         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
4420         switch(obj->tag) {
4421                 case LDKCOption_u16Z_Some: return 0;
4422                 case LDKCOption_u16Z_None: return 1;
4423                 default: abort();
4424         }
4425 }
4426 int16_t __attribute__((export_name("TS_LDKCOption_u16Z_Some_get_some"))) TS_LDKCOption_u16Z_Some_get_some(uint64_t ptr) {
4427         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
4428         assert(obj->tag == LDKCOption_u16Z_Some);
4429                         int16_t some_conv = obj->some;
4430         return some_conv;
4431 }
4432 uint32_t __attribute__((export_name("TS_LDKAPIError_ty_from_ptr"))) TS_LDKAPIError_ty_from_ptr(uint64_t ptr) {
4433         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
4434         switch(obj->tag) {
4435                 case LDKAPIError_APIMisuseError: return 0;
4436                 case LDKAPIError_FeeRateTooHigh: return 1;
4437                 case LDKAPIError_RouteError: return 2;
4438                 case LDKAPIError_ChannelUnavailable: return 3;
4439                 case LDKAPIError_MonitorUpdateFailed: return 4;
4440                 case LDKAPIError_IncompatibleShutdownScript: return 5;
4441                 default: abort();
4442         }
4443 }
4444 jstring __attribute__((export_name("TS_LDKAPIError_APIMisuseError_get_err"))) TS_LDKAPIError_APIMisuseError_get_err(uint64_t ptr) {
4445         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
4446         assert(obj->tag == LDKAPIError_APIMisuseError);
4447                         LDKStr err_str = obj->api_misuse_error.err;
4448                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
4449         return err_conv;
4450 }
4451 jstring __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_err"))) TS_LDKAPIError_FeeRateTooHigh_get_err(uint64_t ptr) {
4452         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
4453         assert(obj->tag == LDKAPIError_FeeRateTooHigh);
4454                         LDKStr err_str = obj->fee_rate_too_high.err;
4455                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
4456         return err_conv;
4457 }
4458 int32_t __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_feerate"))) TS_LDKAPIError_FeeRateTooHigh_get_feerate(uint64_t ptr) {
4459         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
4460         assert(obj->tag == LDKAPIError_FeeRateTooHigh);
4461                         int32_t feerate_conv = obj->fee_rate_too_high.feerate;
4462         return feerate_conv;
4463 }
4464 jstring __attribute__((export_name("TS_LDKAPIError_RouteError_get_err"))) TS_LDKAPIError_RouteError_get_err(uint64_t ptr) {
4465         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
4466         assert(obj->tag == LDKAPIError_RouteError);
4467                         LDKStr err_str = obj->route_error.err;
4468                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
4469         return err_conv;
4470 }
4471 jstring __attribute__((export_name("TS_LDKAPIError_ChannelUnavailable_get_err"))) TS_LDKAPIError_ChannelUnavailable_get_err(uint64_t ptr) {
4472         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
4473         assert(obj->tag == LDKAPIError_ChannelUnavailable);
4474                         LDKStr err_str = obj->channel_unavailable.err;
4475                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
4476         return err_conv;
4477 }
4478 uint64_t __attribute__((export_name("TS_LDKAPIError_IncompatibleShutdownScript_get_script"))) TS_LDKAPIError_IncompatibleShutdownScript_get_script(uint64_t ptr) {
4479         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
4480         assert(obj->tag == LDKAPIError_IncompatibleShutdownScript);
4481                         LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
4482                         uint64_t script_ref = 0;
4483                         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var);
4484                         script_ref = tag_ptr(script_var.inner, false);
4485         return script_ref;
4486 }
4487 static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
4488 CHECK(owner->result_ok);
4489         return *owner->contents.result;
4490 }
4491 void  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_get_ok"))) TS_CResult_NoneAPIErrorZ_get_ok(uint64_t owner) {
4492         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
4493         CResult_NoneAPIErrorZ_get_ok(owner_conv);
4494 }
4495
4496 static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
4497 CHECK(!owner->result_ok);
4498         return APIError_clone(&*owner->contents.err);
4499 }
4500 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_get_err"))) TS_CResult_NoneAPIErrorZ_get_err(uint64_t owner) {
4501         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
4502         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4503         *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv);
4504         uint64_t ret_ref = tag_ptr(ret_copy, true);
4505         return ret_ref;
4506 }
4507
4508 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
4509         LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
4510         for (size_t i = 0; i < ret.datalen; i++) {
4511                 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
4512         }
4513         return ret;
4514 }
4515 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
4516         LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
4517         for (size_t i = 0; i < ret.datalen; i++) {
4518                 ret.data[i] = APIError_clone(&orig->data[i]);
4519         }
4520         return ret;
4521 }
4522 static inline struct LDKThirtyTwoBytes CResult__u832APIErrorZ_get_ok(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
4523 CHECK(owner->result_ok);
4524         return ThirtyTwoBytes_clone(&*owner->contents.result);
4525 }
4526 int8_tArray  __attribute__((export_name("TS_CResult__u832APIErrorZ_get_ok"))) TS_CResult__u832APIErrorZ_get_ok(uint64_t owner) {
4527         LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(owner);
4528         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4529         memcpy(ret_arr->elems, CResult__u832APIErrorZ_get_ok(owner_conv).data, 32);
4530         return ret_arr;
4531 }
4532
4533 static inline struct LDKAPIError CResult__u832APIErrorZ_get_err(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
4534 CHECK(!owner->result_ok);
4535         return APIError_clone(&*owner->contents.err);
4536 }
4537 uint64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_get_err"))) TS_CResult__u832APIErrorZ_get_err(uint64_t owner) {
4538         LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(owner);
4539         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4540         *ret_copy = CResult__u832APIErrorZ_get_err(owner_conv);
4541         uint64_t ret_ref = tag_ptr(ret_copy, true);
4542         return ret_ref;
4543 }
4544
4545 uint32_t __attribute__((export_name("TS_LDKPaymentSendFailure_ty_from_ptr"))) TS_LDKPaymentSendFailure_ty_from_ptr(uint64_t ptr) {
4546         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4547         switch(obj->tag) {
4548                 case LDKPaymentSendFailure_ParameterError: return 0;
4549                 case LDKPaymentSendFailure_PathParameterError: return 1;
4550                 case LDKPaymentSendFailure_AllFailedRetrySafe: return 2;
4551                 case LDKPaymentSendFailure_PartialFailure: return 3;
4552                 default: abort();
4553         }
4554 }
4555 uint64_t __attribute__((export_name("TS_LDKPaymentSendFailure_ParameterError_get_parameter_error"))) TS_LDKPaymentSendFailure_ParameterError_get_parameter_error(uint64_t ptr) {
4556         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4557         assert(obj->tag == LDKPaymentSendFailure_ParameterError);
4558                         uint64_t parameter_error_ref = tag_ptr(&obj->parameter_error, false);
4559         return parameter_error_ref;
4560 }
4561 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PathParameterError_get_path_parameter_error"))) TS_LDKPaymentSendFailure_PathParameterError_get_path_parameter_error(uint64_t ptr) {
4562         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4563         assert(obj->tag == LDKPaymentSendFailure_PathParameterError);
4564                         LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
4565                         uint64_tArray path_parameter_error_arr = NULL;
4566                         path_parameter_error_arr = init_uint64_tArray(path_parameter_error_var.datalen, __LINE__);
4567                         uint64_t *path_parameter_error_arr_ptr = (uint64_t*)(((uint8_t*)path_parameter_error_arr) + 8);
4568                         for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
4569                                 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4570                                 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
4571                                 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
4572                                 path_parameter_error_arr_ptr[w] = tag_ptr(path_parameter_error_conv_22_conv, true);
4573                         }
4574                         
4575         return path_parameter_error_arr;
4576 }
4577 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_AllFailedRetrySafe_get_all_failed_retry_safe"))) TS_LDKPaymentSendFailure_AllFailedRetrySafe_get_all_failed_retry_safe(uint64_t ptr) {
4578         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4579         assert(obj->tag == LDKPaymentSendFailure_AllFailedRetrySafe);
4580                         LDKCVec_APIErrorZ all_failed_retry_safe_var = obj->all_failed_retry_safe;
4581                         uint64_tArray all_failed_retry_safe_arr = NULL;
4582                         all_failed_retry_safe_arr = init_uint64_tArray(all_failed_retry_safe_var.datalen, __LINE__);
4583                         uint64_t *all_failed_retry_safe_arr_ptr = (uint64_t*)(((uint8_t*)all_failed_retry_safe_arr) + 8);
4584                         for (size_t k = 0; k < all_failed_retry_safe_var.datalen; k++) {
4585                                 uint64_t all_failed_retry_safe_conv_10_ref = tag_ptr(&all_failed_retry_safe_var.data[k], false);
4586                                 all_failed_retry_safe_arr_ptr[k] = all_failed_retry_safe_conv_10_ref;
4587                         }
4588                         
4589         return all_failed_retry_safe_arr;
4590 }
4591 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_results"))) TS_LDKPaymentSendFailure_PartialFailure_get_results(uint64_t ptr) {
4592         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4593         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
4594                         LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
4595                         uint64_tArray results_arr = NULL;
4596                         results_arr = init_uint64_tArray(results_var.datalen, __LINE__);
4597                         uint64_t *results_arr_ptr = (uint64_t*)(((uint8_t*)results_arr) + 8);
4598                         for (size_t w = 0; w < results_var.datalen; w++) {
4599                                 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4600                                 *results_conv_22_conv = results_var.data[w];
4601                                 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
4602                                 results_arr_ptr[w] = tag_ptr(results_conv_22_conv, true);
4603                         }
4604                         
4605         return results_arr;
4606 }
4607 uint64_t __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_failed_paths_retry"))) TS_LDKPaymentSendFailure_PartialFailure_get_failed_paths_retry(uint64_t ptr) {
4608         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4609         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
4610                         LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
4611                         uint64_t failed_paths_retry_ref = 0;
4612                         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
4613                         failed_paths_retry_ref = tag_ptr(failed_paths_retry_var.inner, false);
4614         return failed_paths_retry_ref;
4615 }
4616 int8_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_payment_id"))) TS_LDKPaymentSendFailure_PartialFailure_get_payment_id(uint64_t ptr) {
4617         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4618         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
4619                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
4620                         memcpy(payment_id_arr->elems, obj->partial_failure.payment_id.data, 32);
4621         return payment_id_arr;
4622 }
4623 static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentSendFailureZ_get_ok(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR owner){
4624 CHECK(owner->result_ok);
4625         return ThirtyTwoBytes_clone(&*owner->contents.result);
4626 }
4627 int8_tArray  __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_get_ok"))) TS_CResult_PaymentIdPaymentSendFailureZ_get_ok(uint64_t owner) {
4628         LDKCResult_PaymentIdPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)untag_ptr(owner);
4629         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4630         memcpy(ret_arr->elems, CResult_PaymentIdPaymentSendFailureZ_get_ok(owner_conv).data, 32);
4631         return ret_arr;
4632 }
4633
4634 static inline struct LDKPaymentSendFailure CResult_PaymentIdPaymentSendFailureZ_get_err(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR owner){
4635 CHECK(!owner->result_ok);
4636         return PaymentSendFailure_clone(&*owner->contents.err);
4637 }
4638 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_get_err"))) TS_CResult_PaymentIdPaymentSendFailureZ_get_err(uint64_t owner) {
4639         LDKCResult_PaymentIdPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)untag_ptr(owner);
4640         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
4641         *ret_copy = CResult_PaymentIdPaymentSendFailureZ_get_err(owner_conv);
4642         uint64_t ret_ref = tag_ptr(ret_copy, true);
4643         return ret_ref;
4644 }
4645
4646 static inline void CResult_NonePaymentSendFailureZ_get_ok(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
4647 CHECK(owner->result_ok);
4648         return *owner->contents.result;
4649 }
4650 void  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_ok"))) TS_CResult_NonePaymentSendFailureZ_get_ok(uint64_t owner) {
4651         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
4652         CResult_NonePaymentSendFailureZ_get_ok(owner_conv);
4653 }
4654
4655 static inline struct LDKPaymentSendFailure CResult_NonePaymentSendFailureZ_get_err(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
4656 CHECK(!owner->result_ok);
4657         return PaymentSendFailure_clone(&*owner->contents.err);
4658 }
4659 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_err"))) TS_CResult_NonePaymentSendFailureZ_get_err(uint64_t owner) {
4660         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
4661         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
4662         *ret_copy = CResult_NonePaymentSendFailureZ_get_err(owner_conv);
4663         uint64_t ret_ref = tag_ptr(ret_copy, true);
4664         return ret_ref;
4665 }
4666
4667 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_a(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
4668         return ThirtyTwoBytes_clone(&owner->a);
4669 }
4670 int8_tArray  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_get_a"))) TS_C2Tuple_PaymentHashPaymentIdZ_get_a(uint64_t owner) {
4671         LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(owner);
4672         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4673         memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentIdZ_get_a(owner_conv).data, 32);
4674         return ret_arr;
4675 }
4676
4677 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_b(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
4678         return ThirtyTwoBytes_clone(&owner->b);
4679 }
4680 int8_tArray  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_get_b"))) TS_C2Tuple_PaymentHashPaymentIdZ_get_b(uint64_t owner) {
4681         LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(owner);
4682         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4683         memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentIdZ_get_b(owner_conv).data, 32);
4684         return ret_arr;
4685 }
4686
4687 static inline struct LDKC2Tuple_PaymentHashPaymentIdZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
4688 CHECK(owner->result_ok);
4689         return C2Tuple_PaymentHashPaymentIdZ_clone(&*owner->contents.result);
4690 }
4691 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(uint64_t owner) {
4692         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(owner);
4693         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
4694         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(owner_conv);
4695         return tag_ptr(ret_conv, true);
4696 }
4697
4698 static inline struct LDKPaymentSendFailure CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
4699 CHECK(!owner->result_ok);
4700         return PaymentSendFailure_clone(&*owner->contents.err);
4701 }
4702 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(uint64_t owner) {
4703         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(owner);
4704         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
4705         *ret_copy = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(owner_conv);
4706         uint64_t ret_ref = tag_ptr(ret_copy, true);
4707         return ret_ref;
4708 }
4709
4710 static inline LDKCVec_ThirtyTwoBytesZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_ThirtyTwoBytesZ *orig) {
4711         LDKCVec_ThirtyTwoBytesZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_ThirtyTwoBytesZ clone bytes"), .datalen = orig->datalen };
4712         for (size_t i = 0; i < ret.datalen; i++) {
4713                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
4714         }
4715         return ret;
4716 }
4717 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_a(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
4718         return ThirtyTwoBytes_clone(&owner->a);
4719 }
4720 int8_tArray  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_get_a"))) TS_C2Tuple_PaymentHashPaymentSecretZ_get_a(uint64_t owner) {
4721         LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(owner);
4722         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4723         memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentSecretZ_get_a(owner_conv).data, 32);
4724         return ret_arr;
4725 }
4726
4727 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_b(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
4728         return ThirtyTwoBytes_clone(&owner->b);
4729 }
4730 int8_tArray  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_get_b"))) TS_C2Tuple_PaymentHashPaymentSecretZ_get_b(uint64_t owner) {
4731         LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(owner);
4732         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4733         memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentSecretZ_get_b(owner_conv).data, 32);
4734         return ret_arr;
4735 }
4736
4737 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
4738 CHECK(owner->result_ok);
4739         return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
4740 }
4741 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(uint64_t owner) {
4742         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(owner);
4743         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
4744         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(owner_conv);
4745         return tag_ptr(ret_conv, true);
4746 }
4747
4748 static inline void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
4749 CHECK(!owner->result_ok);
4750         return *owner->contents.err;
4751 }
4752 void  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(uint64_t owner) {
4753         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(owner);
4754         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(owner_conv);
4755 }
4756
4757 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
4758 CHECK(owner->result_ok);
4759         return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
4760 }
4761 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(uint64_t owner) {
4762         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(owner);
4763         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
4764         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(owner_conv);
4765         return tag_ptr(ret_conv, true);
4766 }
4767
4768 static inline struct LDKAPIError CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
4769 CHECK(!owner->result_ok);
4770         return APIError_clone(&*owner->contents.err);
4771 }
4772 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(uint64_t owner) {
4773         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(owner);
4774         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4775         *ret_copy = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(owner_conv);
4776         uint64_t ret_ref = tag_ptr(ret_copy, true);
4777         return ret_ref;
4778 }
4779
4780 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretNoneZ_get_ok(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
4781 CHECK(owner->result_ok);
4782         return ThirtyTwoBytes_clone(&*owner->contents.result);
4783 }
4784 int8_tArray  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_get_ok"))) TS_CResult_PaymentSecretNoneZ_get_ok(uint64_t owner) {
4785         LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(owner);
4786         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4787         memcpy(ret_arr->elems, CResult_PaymentSecretNoneZ_get_ok(owner_conv).data, 32);
4788         return ret_arr;
4789 }
4790
4791 static inline void CResult_PaymentSecretNoneZ_get_err(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
4792 CHECK(!owner->result_ok);
4793         return *owner->contents.err;
4794 }
4795 void  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_get_err"))) TS_CResult_PaymentSecretNoneZ_get_err(uint64_t owner) {
4796         LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(owner);
4797         CResult_PaymentSecretNoneZ_get_err(owner_conv);
4798 }
4799
4800 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretAPIErrorZ_get_ok(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
4801 CHECK(owner->result_ok);
4802         return ThirtyTwoBytes_clone(&*owner->contents.result);
4803 }
4804 int8_tArray  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_get_ok"))) TS_CResult_PaymentSecretAPIErrorZ_get_ok(uint64_t owner) {
4805         LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(owner);
4806         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4807         memcpy(ret_arr->elems, CResult_PaymentSecretAPIErrorZ_get_ok(owner_conv).data, 32);
4808         return ret_arr;
4809 }
4810
4811 static inline struct LDKAPIError CResult_PaymentSecretAPIErrorZ_get_err(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
4812 CHECK(!owner->result_ok);
4813         return APIError_clone(&*owner->contents.err);
4814 }
4815 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_get_err"))) TS_CResult_PaymentSecretAPIErrorZ_get_err(uint64_t owner) {
4816         LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(owner);
4817         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4818         *ret_copy = CResult_PaymentSecretAPIErrorZ_get_err(owner_conv);
4819         uint64_t ret_ref = tag_ptr(ret_copy, true);
4820         return ret_ref;
4821 }
4822
4823 static inline struct LDKThirtyTwoBytes CResult_PaymentPreimageAPIErrorZ_get_ok(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
4824 CHECK(owner->result_ok);
4825         return ThirtyTwoBytes_clone(&*owner->contents.result);
4826 }
4827 int8_tArray  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_get_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_get_ok(uint64_t owner) {
4828         LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(owner);
4829         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4830         memcpy(ret_arr->elems, CResult_PaymentPreimageAPIErrorZ_get_ok(owner_conv).data, 32);
4831         return ret_arr;
4832 }
4833
4834 static inline struct LDKAPIError CResult_PaymentPreimageAPIErrorZ_get_err(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
4835 CHECK(!owner->result_ok);
4836         return APIError_clone(&*owner->contents.err);
4837 }
4838 uint64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_get_err"))) TS_CResult_PaymentPreimageAPIErrorZ_get_err(uint64_t owner) {
4839         LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(owner);
4840         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4841         *ret_copy = CResult_PaymentPreimageAPIErrorZ_get_err(owner_conv);
4842         uint64_t ret_ref = tag_ptr(ret_copy, true);
4843         return ret_ref;
4844 }
4845
4846 static inline struct LDKCounterpartyForwardingInfo CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
4847         LDKCounterpartyForwardingInfo ret = *owner->contents.result;
4848         ret.is_owned = false;
4849         return ret;
4850 }
4851 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(uint64_t owner) {
4852         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
4853         LDKCounterpartyForwardingInfo ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(owner_conv);
4854         uint64_t ret_ref = 0;
4855         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4856         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4857         return ret_ref;
4858 }
4859
4860 static inline struct LDKDecodeError CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
4861         LDKDecodeError ret = *owner->contents.err;
4862         ret.is_owned = false;
4863         return ret;
4864 }
4865 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(uint64_t owner) {
4866         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
4867         LDKDecodeError ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(owner_conv);
4868         uint64_t ret_ref = 0;
4869         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4870         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4871         return ret_ref;
4872 }
4873
4874 static inline struct LDKChannelCounterparty CResult_ChannelCounterpartyDecodeErrorZ_get_ok(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
4875         LDKChannelCounterparty ret = *owner->contents.result;
4876         ret.is_owned = false;
4877         return ret;
4878 }
4879 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_get_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_get_ok(uint64_t owner) {
4880         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
4881         LDKChannelCounterparty ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_ok(owner_conv);
4882         uint64_t ret_ref = 0;
4883         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4884         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4885         return ret_ref;
4886 }
4887
4888 static inline struct LDKDecodeError CResult_ChannelCounterpartyDecodeErrorZ_get_err(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
4889         LDKDecodeError ret = *owner->contents.err;
4890         ret.is_owned = false;
4891         return ret;
4892 }
4893 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_get_err"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_get_err(uint64_t owner) {
4894         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
4895         LDKDecodeError ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_err(owner_conv);
4896         uint64_t ret_ref = 0;
4897         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4898         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4899         return ret_ref;
4900 }
4901
4902 static inline struct LDKChannelDetails CResult_ChannelDetailsDecodeErrorZ_get_ok(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
4903         LDKChannelDetails ret = *owner->contents.result;
4904         ret.is_owned = false;
4905         return ret;
4906 }
4907 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_get_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_get_ok(uint64_t owner) {
4908         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
4909         LDKChannelDetails ret_var = CResult_ChannelDetailsDecodeErrorZ_get_ok(owner_conv);
4910         uint64_t ret_ref = 0;
4911         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4912         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4913         return ret_ref;
4914 }
4915
4916 static inline struct LDKDecodeError CResult_ChannelDetailsDecodeErrorZ_get_err(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
4917         LDKDecodeError ret = *owner->contents.err;
4918         ret.is_owned = false;
4919         return ret;
4920 }
4921 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_get_err"))) TS_CResult_ChannelDetailsDecodeErrorZ_get_err(uint64_t owner) {
4922         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
4923         LDKDecodeError ret_var = CResult_ChannelDetailsDecodeErrorZ_get_err(owner_conv);
4924         uint64_t ret_ref = 0;
4925         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4926         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4927         return ret_ref;
4928 }
4929
4930 static inline struct LDKPhantomRouteHints CResult_PhantomRouteHintsDecodeErrorZ_get_ok(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
4931         LDKPhantomRouteHints ret = *owner->contents.result;
4932         ret.is_owned = false;
4933         return ret;
4934 }
4935 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_get_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_get_ok(uint64_t owner) {
4936         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
4937         LDKPhantomRouteHints ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_ok(owner_conv);
4938         uint64_t ret_ref = 0;
4939         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4940         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4941         return ret_ref;
4942 }
4943
4944 static inline struct LDKDecodeError CResult_PhantomRouteHintsDecodeErrorZ_get_err(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
4945         LDKDecodeError ret = *owner->contents.err;
4946         ret.is_owned = false;
4947         return ret;
4948 }
4949 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_get_err"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_get_err(uint64_t owner) {
4950         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
4951         LDKDecodeError ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_err(owner_conv);
4952         uint64_t ret_ref = 0;
4953         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4954         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4955         return ret_ref;
4956 }
4957
4958 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
4959         LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
4960         for (size_t i = 0; i < ret.datalen; i++) {
4961                 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
4962         }
4963         return ret;
4964 }
4965 typedef struct LDKWatch_JCalls {
4966         atomic_size_t refcnt;
4967         uint32_t instance_ptr;
4968 } LDKWatch_JCalls;
4969 static void LDKWatch_JCalls_free(void* this_arg) {
4970         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
4971         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4972                 FREE(j_calls);
4973         }
4974 }
4975 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
4976         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
4977         LDKOutPoint funding_txo_var = funding_txo;
4978         uint64_t funding_txo_ref = 0;
4979         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
4980         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
4981         LDKChannelMonitor monitor_var = monitor;
4982         uint64_t monitor_ref = 0;
4983         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
4984         monitor_ref = tag_ptr(monitor_var.inner, monitor_var.is_owned);
4985         uint64_t ret = js_invoke_function_bbuuuu(j_calls->instance_ptr, 16, funding_txo_ref, monitor_ref, 0, 0, 0, 0);
4986         void* ret_ptr = untag_ptr(ret);
4987         CHECK_ACCESS(ret_ptr);
4988         LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
4989         FREE(untag_ptr(ret));
4990         return ret_conv;
4991 }
4992 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
4993         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
4994         LDKOutPoint funding_txo_var = funding_txo;
4995         uint64_t funding_txo_ref = 0;
4996         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
4997         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
4998         LDKChannelMonitorUpdate update_var = update;
4999         uint64_t update_ref = 0;
5000         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
5001         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
5002         uint64_t ret = js_invoke_function_bbuuuu(j_calls->instance_ptr, 17, funding_txo_ref, update_ref, 0, 0, 0, 0);
5003         void* ret_ptr = untag_ptr(ret);
5004         CHECK_ACCESS(ret_ptr);
5005         LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
5006         FREE(untag_ptr(ret));
5007         return ret_conv;
5008 }
5009 LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
5010         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5011         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 18, 0, 0, 0, 0, 0, 0);
5012         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_constr;
5013         ret_constr.datalen = ret->arr_len;
5014         if (ret_constr.datalen > 0)
5015                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
5016         else
5017                 ret_constr.data = NULL;
5018         uint64_t* ret_vals = ret->elems;
5019         for (size_t x = 0; x < ret_constr.datalen; x++) {
5020                 uint64_t ret_conv_49 = ret_vals[x];
5021                 void* ret_conv_49_ptr = untag_ptr(ret_conv_49);
5022                 CHECK_ACCESS(ret_conv_49_ptr);
5023                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ ret_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(ret_conv_49_ptr);
5024                 FREE(untag_ptr(ret_conv_49));
5025                 ret_constr.data[x] = ret_conv_49_conv;
5026         }
5027         FREE(ret);
5028         return ret_constr;
5029 }
5030 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
5031         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
5032         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5033 }
5034 static inline LDKWatch LDKWatch_init (JSValue o) {
5035         LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
5036         atomic_init(&calls->refcnt, 1);
5037         calls->instance_ptr = o;
5038
5039         LDKWatch ret = {
5040                 .this_arg = (void*) calls,
5041                 .watch_channel = watch_channel_LDKWatch_jcall,
5042                 .update_channel = update_channel_LDKWatch_jcall,
5043                 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
5044                 .free = LDKWatch_JCalls_free,
5045         };
5046         return ret;
5047 }
5048 uint64_t  __attribute__((export_name("TS_LDKWatch_new"))) TS_LDKWatch_new(JSValue o) {
5049         LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
5050         *res_ptr = LDKWatch_init(o);
5051         return tag_ptr(res_ptr, true);
5052 }
5053 uint64_t  __attribute__((export_name("TS_Watch_watch_channel"))) TS_Watch_watch_channel(uint64_t this_arg, uint64_t funding_txo, uint64_t monitor) {
5054         void* this_arg_ptr = untag_ptr(this_arg);
5055         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5056         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5057         LDKOutPoint funding_txo_conv;
5058         funding_txo_conv.inner = untag_ptr(funding_txo);
5059         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
5060         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
5061         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
5062         LDKChannelMonitor monitor_conv;
5063         monitor_conv.inner = untag_ptr(monitor);
5064         monitor_conv.is_owned = ptr_is_owned(monitor);
5065         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
5066         monitor_conv = ChannelMonitor_clone(&monitor_conv);
5067         LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5068         *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
5069         return tag_ptr(ret_conv, true);
5070 }
5071
5072 uint64_t  __attribute__((export_name("TS_Watch_update_channel"))) TS_Watch_update_channel(uint64_t this_arg, uint64_t funding_txo, uint64_t update) {
5073         void* this_arg_ptr = untag_ptr(this_arg);
5074         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5075         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5076         LDKOutPoint funding_txo_conv;
5077         funding_txo_conv.inner = untag_ptr(funding_txo);
5078         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
5079         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
5080         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
5081         LDKChannelMonitorUpdate update_conv;
5082         update_conv.inner = untag_ptr(update);
5083         update_conv.is_owned = ptr_is_owned(update);
5084         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
5085         update_conv = ChannelMonitorUpdate_clone(&update_conv);
5086         LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5087         *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
5088         return tag_ptr(ret_conv, true);
5089 }
5090
5091 uint64_tArray  __attribute__((export_name("TS_Watch_release_pending_monitor_events"))) TS_Watch_release_pending_monitor_events(uint64_t this_arg) {
5092         void* this_arg_ptr = untag_ptr(this_arg);
5093         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5094         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5095         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
5096         uint64_tArray ret_arr = NULL;
5097         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
5098         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
5099         for (size_t x = 0; x < ret_var.datalen; x++) {
5100                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv_49_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
5101                 *ret_conv_49_conv = ret_var.data[x];
5102                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
5103         }
5104         
5105         FREE(ret_var.data);
5106         return ret_arr;
5107 }
5108
5109 typedef struct LDKBroadcasterInterface_JCalls {
5110         atomic_size_t refcnt;
5111         uint32_t instance_ptr;
5112 } LDKBroadcasterInterface_JCalls;
5113 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
5114         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
5115         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5116                 FREE(j_calls);
5117         }
5118 }
5119 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
5120         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
5121         LDKTransaction tx_var = tx;
5122         int8_tArray tx_arr = init_int8_tArray(tx_var.datalen, __LINE__);
5123         memcpy(tx_arr->elems, tx_var.data, tx_var.datalen);
5124         Transaction_free(tx_var);
5125         js_invoke_function_uuuuuu(j_calls->instance_ptr, 19, (uint32_t)tx_arr, 0, 0, 0, 0, 0);
5126 }
5127 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
5128         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
5129         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5130 }
5131 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JSValue o) {
5132         LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
5133         atomic_init(&calls->refcnt, 1);
5134         calls->instance_ptr = o;
5135
5136         LDKBroadcasterInterface ret = {
5137                 .this_arg = (void*) calls,
5138                 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
5139                 .free = LDKBroadcasterInterface_JCalls_free,
5140         };
5141         return ret;
5142 }
5143 uint64_t  __attribute__((export_name("TS_LDKBroadcasterInterface_new"))) TS_LDKBroadcasterInterface_new(JSValue o) {
5144         LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
5145         *res_ptr = LDKBroadcasterInterface_init(o);
5146         return tag_ptr(res_ptr, true);
5147 }
5148 void  __attribute__((export_name("TS_BroadcasterInterface_broadcast_transaction"))) TS_BroadcasterInterface_broadcast_transaction(uint64_t this_arg, int8_tArray tx) {
5149         void* this_arg_ptr = untag_ptr(this_arg);
5150         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5151         LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
5152         LDKTransaction tx_ref;
5153         tx_ref.datalen = tx->arr_len;
5154         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
5155         memcpy(tx_ref.data, tx->elems, tx_ref.datalen); FREE(tx);
5156         tx_ref.data_is_owned = true;
5157         (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
5158 }
5159
5160 typedef struct LDKKeysInterface_JCalls {
5161         atomic_size_t refcnt;
5162         uint32_t instance_ptr;
5163 } LDKKeysInterface_JCalls;
5164 static void LDKKeysInterface_JCalls_free(void* this_arg) {
5165         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5166         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5167                 FREE(j_calls);
5168         }
5169 }
5170 LDKCResult_SecretKeyNoneZ get_node_secret_LDKKeysInterface_jcall(const void* this_arg, LDKRecipient recipient) {
5171         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5172         uint32_t recipient_conv = LDKRecipient_to_js(recipient);
5173         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 20, recipient_conv, 0, 0, 0, 0, 0);
5174         void* ret_ptr = untag_ptr(ret);
5175         CHECK_ACCESS(ret_ptr);
5176         LDKCResult_SecretKeyNoneZ ret_conv = *(LDKCResult_SecretKeyNoneZ*)(ret_ptr);
5177         FREE(untag_ptr(ret));
5178         return ret_conv;
5179 }
5180 LDKCResult_SharedSecretNoneZ ecdh_LDKKeysInterface_jcall(const void* this_arg, LDKRecipient recipient, LDKPublicKey other_key, LDKCOption_ScalarZ tweak) {
5181         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5182         uint32_t recipient_conv = LDKRecipient_to_js(recipient);
5183         int8_tArray other_key_arr = init_int8_tArray(33, __LINE__);
5184         memcpy(other_key_arr->elems, other_key.compressed_form, 33);
5185         LDKCOption_ScalarZ *tweak_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ");
5186         *tweak_copy = tweak;
5187         uint64_t tweak_ref = tag_ptr(tweak_copy, true);
5188         uint64_t ret = js_invoke_function_uubuuu(j_calls->instance_ptr, 21, recipient_conv, (uint32_t)other_key_arr, tweak_ref, 0, 0, 0);
5189         void* ret_ptr = untag_ptr(ret);
5190         CHECK_ACCESS(ret_ptr);
5191         LDKCResult_SharedSecretNoneZ ret_conv = *(LDKCResult_SharedSecretNoneZ*)(ret_ptr);
5192         FREE(untag_ptr(ret));
5193         return ret_conv;
5194 }
5195 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
5196         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5197         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 22, 0, 0, 0, 0, 0, 0);
5198         LDKCVec_u8Z ret_ref;
5199         ret_ref.datalen = ret->arr_len;
5200         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
5201         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
5202         return ret_ref;
5203 }
5204 LDKShutdownScript get_shutdown_scriptpubkey_LDKKeysInterface_jcall(const void* this_arg) {
5205         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5206         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 23, 0, 0, 0, 0, 0, 0);
5207         LDKShutdownScript ret_conv;
5208         ret_conv.inner = untag_ptr(ret);
5209         ret_conv.is_owned = ptr_is_owned(ret);
5210         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
5211         return ret_conv;
5212 }
5213 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
5214         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5215         jboolean inbound_conv = inbound;
5216         int64_t channel_value_satoshis_conv = channel_value_satoshis;
5217         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 24, inbound_conv, channel_value_satoshis_conv, 0, 0, 0, 0);
5218         void* ret_ptr = untag_ptr(ret);
5219         CHECK_ACCESS(ret_ptr);
5220         LDKSign ret_conv = *(LDKSign*)(ret_ptr);
5221         FREE(untag_ptr(ret));
5222         return ret_conv;
5223 }
5224 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
5225         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5226         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 25, 0, 0, 0, 0, 0, 0);
5227         LDKThirtyTwoBytes ret_ref;
5228         CHECK(ret->arr_len == 32);
5229         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
5230         return ret_ref;
5231 }
5232 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
5233         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5234         LDKu8slice reader_var = reader;
5235         int8_tArray reader_arr = init_int8_tArray(reader_var.datalen, __LINE__);
5236         memcpy(reader_arr->elems, reader_var.data, reader_var.datalen);
5237         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 26, (uint32_t)reader_arr, 0, 0, 0, 0, 0);
5238         void* ret_ptr = untag_ptr(ret);
5239         CHECK_ACCESS(ret_ptr);
5240         LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(ret_ptr);
5241         FREE(untag_ptr(ret));
5242         return ret_conv;
5243 }
5244 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice hrp_bytes, LDKCVec_u5Z invoice_data, LDKRecipient receipient) {
5245         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5246         LDKu8slice hrp_bytes_var = hrp_bytes;
5247         int8_tArray hrp_bytes_arr = init_int8_tArray(hrp_bytes_var.datalen, __LINE__);
5248         memcpy(hrp_bytes_arr->elems, hrp_bytes_var.data, hrp_bytes_var.datalen);
5249         LDKCVec_u5Z invoice_data_var = invoice_data;
5250         ptrArray invoice_data_arr = NULL;
5251         invoice_data_arr = init_ptrArray(invoice_data_var.datalen, __LINE__);
5252         int8_t *invoice_data_arr_ptr = (int8_t*)(((uint8_t*)invoice_data_arr) + 8);
5253         for (size_t h = 0; h < invoice_data_var.datalen; h++) {
5254                 uint8_t invoice_data_conv_7_val = invoice_data_var.data[h]._0;
5255                 invoice_data_arr_ptr[h] = invoice_data_conv_7_val;
5256         }
5257         
5258         FREE(invoice_data_var.data);
5259         uint32_t receipient_conv = LDKRecipient_to_js(receipient);
5260         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);
5261         void* ret_ptr = untag_ptr(ret);
5262         CHECK_ACCESS(ret_ptr);
5263         LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
5264         FREE(untag_ptr(ret));
5265         return ret_conv;
5266 }
5267 LDKThirtyTwoBytes get_inbound_payment_key_material_LDKKeysInterface_jcall(const void* this_arg) {
5268         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5269         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 28, 0, 0, 0, 0, 0, 0);
5270         LDKThirtyTwoBytes ret_ref;
5271         CHECK(ret->arr_len == 32);
5272         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
5273         return ret_ref;
5274 }
5275 static void LDKKeysInterface_JCalls_cloned(LDKKeysInterface* new_obj) {
5276         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) new_obj->this_arg;
5277         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5278 }
5279 static inline LDKKeysInterface LDKKeysInterface_init (JSValue o) {
5280         LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
5281         atomic_init(&calls->refcnt, 1);
5282         calls->instance_ptr = o;
5283
5284         LDKKeysInterface ret = {
5285                 .this_arg = (void*) calls,
5286                 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
5287                 .ecdh = ecdh_LDKKeysInterface_jcall,
5288                 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
5289                 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKKeysInterface_jcall,
5290                 .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
5291                 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
5292                 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
5293                 .sign_invoice = sign_invoice_LDKKeysInterface_jcall,
5294                 .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKKeysInterface_jcall,
5295                 .free = LDKKeysInterface_JCalls_free,
5296         };
5297         return ret;
5298 }
5299 uint64_t  __attribute__((export_name("TS_LDKKeysInterface_new"))) TS_LDKKeysInterface_new(JSValue o) {
5300         LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
5301         *res_ptr = LDKKeysInterface_init(o);
5302         return tag_ptr(res_ptr, true);
5303 }
5304 uint64_t  __attribute__((export_name("TS_KeysInterface_get_node_secret"))) TS_KeysInterface_get_node_secret(uint64_t this_arg, uint32_t recipient) {
5305         void* this_arg_ptr = untag_ptr(this_arg);
5306         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5307         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5308         LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
5309         LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
5310         *ret_conv = (this_arg_conv->get_node_secret)(this_arg_conv->this_arg, recipient_conv);
5311         return tag_ptr(ret_conv, true);
5312 }
5313
5314 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) {
5315         void* this_arg_ptr = untag_ptr(this_arg);
5316         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5317         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5318         LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
5319         LDKPublicKey other_key_ref;
5320         CHECK(other_key->arr_len == 33);
5321         memcpy(other_key_ref.compressed_form, other_key->elems, 33); FREE(other_key);
5322         void* tweak_ptr = untag_ptr(tweak);
5323         CHECK_ACCESS(tweak_ptr);
5324         LDKCOption_ScalarZ tweak_conv = *(LDKCOption_ScalarZ*)(tweak_ptr);
5325         // WARNING: we may need a move here but no clone is available for LDKCOption_ScalarZ
5326         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
5327         *ret_conv = (this_arg_conv->ecdh)(this_arg_conv->this_arg, recipient_conv, other_key_ref, tweak_conv);
5328         return tag_ptr(ret_conv, true);
5329 }
5330
5331 int8_tArray  __attribute__((export_name("TS_KeysInterface_get_destination_script"))) TS_KeysInterface_get_destination_script(uint64_t this_arg) {
5332         void* this_arg_ptr = untag_ptr(this_arg);
5333         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5334         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5335         LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
5336         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
5337         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
5338         CVec_u8Z_free(ret_var);
5339         return ret_arr;
5340 }
5341
5342 uint64_t  __attribute__((export_name("TS_KeysInterface_get_shutdown_scriptpubkey"))) TS_KeysInterface_get_shutdown_scriptpubkey(uint64_t this_arg) {
5343         void* this_arg_ptr = untag_ptr(this_arg);
5344         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5345         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5346         LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
5347         uint64_t ret_ref = 0;
5348         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5349         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5350         return ret_ref;
5351 }
5352
5353 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) {
5354         void* this_arg_ptr = untag_ptr(this_arg);
5355         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5356         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5357         LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
5358         *ret_ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
5359         return tag_ptr(ret_ret, true);
5360 }
5361
5362 int8_tArray  __attribute__((export_name("TS_KeysInterface_get_secure_random_bytes"))) TS_KeysInterface_get_secure_random_bytes(uint64_t this_arg) {
5363         void* this_arg_ptr = untag_ptr(this_arg);
5364         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5365         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5366         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5367         memcpy(ret_arr->elems, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32);
5368         return ret_arr;
5369 }
5370
5371 uint64_t  __attribute__((export_name("TS_KeysInterface_read_chan_signer"))) TS_KeysInterface_read_chan_signer(uint64_t this_arg, int8_tArray reader) {
5372         void* this_arg_ptr = untag_ptr(this_arg);
5373         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5374         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5375         LDKu8slice reader_ref;
5376         reader_ref.datalen = reader->arr_len;
5377         reader_ref.data = reader->elems;
5378         LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
5379         *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
5380         FREE(reader);
5381         return tag_ptr(ret_conv, true);
5382 }
5383
5384 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) {
5385         void* this_arg_ptr = untag_ptr(this_arg);
5386         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5387         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5388         LDKu8slice hrp_bytes_ref;
5389         hrp_bytes_ref.datalen = hrp_bytes->arr_len;
5390         hrp_bytes_ref.data = hrp_bytes->elems;
5391         LDKCVec_u5Z invoice_data_constr;
5392         invoice_data_constr.datalen = invoice_data->arr_len;
5393         if (invoice_data_constr.datalen > 0)
5394                 invoice_data_constr.data = MALLOC(invoice_data_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
5395         else
5396                 invoice_data_constr.data = NULL;
5397         int8_t* invoice_data_vals = (void*) invoice_data->elems;
5398         for (size_t h = 0; h < invoice_data_constr.datalen; h++) {
5399                 int8_t invoice_data_conv_7 = invoice_data_vals[h];
5400                 
5401                 invoice_data_constr.data[h] = (LDKu5){ ._0 = invoice_data_conv_7 };
5402         }
5403         FREE(invoice_data);
5404         LDKRecipient receipient_conv = LDKRecipient_from_js(receipient);
5405         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
5406         *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, hrp_bytes_ref, invoice_data_constr, receipient_conv);
5407         FREE(hrp_bytes);
5408         return tag_ptr(ret_conv, true);
5409 }
5410
5411 int8_tArray  __attribute__((export_name("TS_KeysInterface_get_inbound_payment_key_material"))) TS_KeysInterface_get_inbound_payment_key_material(uint64_t this_arg) {
5412         void* this_arg_ptr = untag_ptr(this_arg);
5413         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5414         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5415         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5416         memcpy(ret_arr->elems, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data, 32);
5417         return ret_arr;
5418 }
5419
5420 typedef struct LDKFeeEstimator_JCalls {
5421         atomic_size_t refcnt;
5422         uint32_t instance_ptr;
5423 } LDKFeeEstimator_JCalls;
5424 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
5425         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
5426         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5427                 FREE(j_calls);
5428         }
5429 }
5430 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
5431         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
5432         uint32_t confirmation_target_conv = LDKConfirmationTarget_to_js(confirmation_target);
5433         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 29, confirmation_target_conv, 0, 0, 0, 0, 0);
5434 }
5435 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
5436         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
5437         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5438 }
5439 static inline LDKFeeEstimator LDKFeeEstimator_init (JSValue o) {
5440         LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
5441         atomic_init(&calls->refcnt, 1);
5442         calls->instance_ptr = o;
5443
5444         LDKFeeEstimator ret = {
5445                 .this_arg = (void*) calls,
5446                 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
5447                 .free = LDKFeeEstimator_JCalls_free,
5448         };
5449         return ret;
5450 }
5451 uint64_t  __attribute__((export_name("TS_LDKFeeEstimator_new"))) TS_LDKFeeEstimator_new(JSValue o) {
5452         LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
5453         *res_ptr = LDKFeeEstimator_init(o);
5454         return tag_ptr(res_ptr, true);
5455 }
5456 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) {
5457         void* this_arg_ptr = untag_ptr(this_arg);
5458         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5459         LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
5460         LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_js(confirmation_target);
5461         int32_t ret_conv = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
5462         return ret_conv;
5463 }
5464
5465 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelManagerZ_get_a(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
5466         return ThirtyTwoBytes_clone(&owner->a);
5467 }
5468 int8_tArray  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_get_a"))) TS_C2Tuple_BlockHashChannelManagerZ_get_a(uint64_t owner) {
5469         LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)untag_ptr(owner);
5470         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5471         memcpy(ret_arr->elems, C2Tuple_BlockHashChannelManagerZ_get_a(owner_conv).data, 32);
5472         return ret_arr;
5473 }
5474
5475 static inline struct LDKChannelManager C2Tuple_BlockHashChannelManagerZ_get_b(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
5476         LDKChannelManager ret = owner->b;
5477         ret.is_owned = false;
5478         return ret;
5479 }
5480 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_get_b"))) TS_C2Tuple_BlockHashChannelManagerZ_get_b(uint64_t owner) {
5481         LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)untag_ptr(owner);
5482         LDKChannelManager ret_var = C2Tuple_BlockHashChannelManagerZ_get_b(owner_conv);
5483         uint64_t ret_ref = 0;
5484         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5485         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5486         return ret_ref;
5487 }
5488
5489 static inline struct LDKC2Tuple_BlockHashChannelManagerZ *CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
5490 CHECK(owner->result_ok);
5491         return &*owner->contents.result;
5492 }
5493 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(uint64_t owner) {
5494         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(owner);
5495         uint64_t ret_ret = tag_ptr(CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(owner_conv), false);
5496         return ret_ret;
5497 }
5498
5499 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
5500         LDKDecodeError ret = *owner->contents.err;
5501         ret.is_owned = false;
5502         return ret;
5503 }
5504 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(uint64_t owner) {
5505         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(owner);
5506         LDKDecodeError ret_var = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(owner_conv);
5507         uint64_t ret_ref = 0;
5508         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5509         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5510         return ret_ref;
5511 }
5512
5513 static inline struct LDKChannelConfig CResult_ChannelConfigDecodeErrorZ_get_ok(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
5514         LDKChannelConfig ret = *owner->contents.result;
5515         ret.is_owned = false;
5516         return ret;
5517 }
5518 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_get_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_get_ok(uint64_t owner) {
5519         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
5520         LDKChannelConfig ret_var = CResult_ChannelConfigDecodeErrorZ_get_ok(owner_conv);
5521         uint64_t ret_ref = 0;
5522         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5523         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5524         return ret_ref;
5525 }
5526
5527 static inline struct LDKDecodeError CResult_ChannelConfigDecodeErrorZ_get_err(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
5528         LDKDecodeError ret = *owner->contents.err;
5529         ret.is_owned = false;
5530         return ret;
5531 }
5532 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_get_err"))) TS_CResult_ChannelConfigDecodeErrorZ_get_err(uint64_t owner) {
5533         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
5534         LDKDecodeError ret_var = CResult_ChannelConfigDecodeErrorZ_get_err(owner_conv);
5535         uint64_t ret_ref = 0;
5536         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5537         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5538         return ret_ref;
5539 }
5540
5541 static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
5542         LDKOutPoint ret = *owner->contents.result;
5543         ret.is_owned = false;
5544         return ret;
5545 }
5546 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_get_ok"))) TS_CResult_OutPointDecodeErrorZ_get_ok(uint64_t owner) {
5547         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
5548         LDKOutPoint ret_var = CResult_OutPointDecodeErrorZ_get_ok(owner_conv);
5549         uint64_t ret_ref = 0;
5550         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5551         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5552         return ret_ref;
5553 }
5554
5555 static inline struct LDKDecodeError CResult_OutPointDecodeErrorZ_get_err(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
5556         LDKDecodeError ret = *owner->contents.err;
5557         ret.is_owned = false;
5558         return ret;
5559 }
5560 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_get_err"))) TS_CResult_OutPointDecodeErrorZ_get_err(uint64_t owner) {
5561         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
5562         LDKDecodeError ret_var = CResult_OutPointDecodeErrorZ_get_err(owner_conv);
5563         uint64_t ret_ref = 0;
5564         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5565         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5566         return ret_ref;
5567 }
5568
5569 typedef struct LDKType_JCalls {
5570         atomic_size_t refcnt;
5571         uint32_t instance_ptr;
5572 } LDKType_JCalls;
5573 static void LDKType_JCalls_free(void* this_arg) {
5574         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
5575         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5576                 FREE(j_calls);
5577         }
5578 }
5579 uint16_t type_id_LDKType_jcall(const void* this_arg) {
5580         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
5581         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 30, 0, 0, 0, 0, 0, 0);
5582 }
5583 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
5584         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
5585         jstring ret = (jstring)js_invoke_function_uuuuuu(j_calls->instance_ptr, 31, 0, 0, 0, 0, 0, 0);
5586         LDKStr ret_conv = str_ref_to_owned_c(ret);
5587         return ret_conv;
5588 }
5589 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
5590         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
5591         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 32, 0, 0, 0, 0, 0, 0);
5592         LDKCVec_u8Z ret_ref;
5593         ret_ref.datalen = ret->arr_len;
5594         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
5595         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
5596         return ret_ref;
5597 }
5598 static void LDKType_JCalls_cloned(LDKType* new_obj) {
5599         LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
5600         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5601 }
5602 static inline LDKType LDKType_init (JSValue o) {
5603         LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
5604         atomic_init(&calls->refcnt, 1);
5605         calls->instance_ptr = o;
5606
5607         LDKType ret = {
5608                 .this_arg = (void*) calls,
5609                 .type_id = type_id_LDKType_jcall,
5610                 .debug_str = debug_str_LDKType_jcall,
5611                 .write = write_LDKType_jcall,
5612                 .cloned = LDKType_JCalls_cloned,
5613                 .free = LDKType_JCalls_free,
5614         };
5615         return ret;
5616 }
5617 uint64_t  __attribute__((export_name("TS_LDKType_new"))) TS_LDKType_new(JSValue o) {
5618         LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
5619         *res_ptr = LDKType_init(o);
5620         return tag_ptr(res_ptr, true);
5621 }
5622 int16_t  __attribute__((export_name("TS_Type_type_id"))) TS_Type_type_id(uint64_t this_arg) {
5623         void* this_arg_ptr = untag_ptr(this_arg);
5624         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5625         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
5626         int16_t ret_conv = (this_arg_conv->type_id)(this_arg_conv->this_arg);
5627         return ret_conv;
5628 }
5629
5630 jstring  __attribute__((export_name("TS_Type_debug_str"))) TS_Type_debug_str(uint64_t this_arg) {
5631         void* this_arg_ptr = untag_ptr(this_arg);
5632         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5633         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
5634         LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
5635         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
5636         Str_free(ret_str);
5637         return ret_conv;
5638 }
5639
5640 int8_tArray  __attribute__((export_name("TS_Type_write"))) TS_Type_write(uint64_t this_arg) {
5641         void* this_arg_ptr = untag_ptr(this_arg);
5642         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5643         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
5644         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
5645         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
5646         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
5647         CVec_u8Z_free(ret_var);
5648         return ret_arr;
5649 }
5650
5651 uint32_t __attribute__((export_name("TS_LDKCOption_TypeZ_ty_from_ptr"))) TS_LDKCOption_TypeZ_ty_from_ptr(uint64_t ptr) {
5652         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
5653         switch(obj->tag) {
5654                 case LDKCOption_TypeZ_Some: return 0;
5655                 case LDKCOption_TypeZ_None: return 1;
5656                 default: abort();
5657         }
5658 }
5659 uint64_t __attribute__((export_name("TS_LDKCOption_TypeZ_Some_get_some"))) TS_LDKCOption_TypeZ_Some_get_some(uint64_t ptr) {
5660         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
5661         assert(obj->tag == LDKCOption_TypeZ_Some);
5662                         LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
5663                         *some_ret = Type_clone(&obj->some);
5664         return tag_ptr(some_ret, true);
5665 }
5666 static inline struct LDKCOption_TypeZ CResult_COption_TypeZDecodeErrorZ_get_ok(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
5667 CHECK(owner->result_ok);
5668         return COption_TypeZ_clone(&*owner->contents.result);
5669 }
5670 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_get_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_get_ok(uint64_t owner) {
5671         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
5672         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
5673         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_ok(owner_conv);
5674         uint64_t ret_ref = tag_ptr(ret_copy, true);
5675         return ret_ref;
5676 }
5677
5678 static inline struct LDKDecodeError CResult_COption_TypeZDecodeErrorZ_get_err(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
5679         LDKDecodeError ret = *owner->contents.err;
5680         ret.is_owned = false;
5681         return ret;
5682 }
5683 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_get_err"))) TS_CResult_COption_TypeZDecodeErrorZ_get_err(uint64_t owner) {
5684         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
5685         LDKDecodeError ret_var = CResult_COption_TypeZDecodeErrorZ_get_err(owner_conv);
5686         uint64_t ret_ref = 0;
5687         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5688         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5689         return ret_ref;
5690 }
5691
5692 uint32_t __attribute__((export_name("TS_LDKPaymentError_ty_from_ptr"))) TS_LDKPaymentError_ty_from_ptr(uint64_t ptr) {
5693         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
5694         switch(obj->tag) {
5695                 case LDKPaymentError_Invoice: return 0;
5696                 case LDKPaymentError_Routing: return 1;
5697                 case LDKPaymentError_Sending: return 2;
5698                 default: abort();
5699         }
5700 }
5701 jstring __attribute__((export_name("TS_LDKPaymentError_Invoice_get_invoice"))) TS_LDKPaymentError_Invoice_get_invoice(uint64_t ptr) {
5702         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
5703         assert(obj->tag == LDKPaymentError_Invoice);
5704                         LDKStr invoice_str = obj->invoice;
5705                         jstring invoice_conv = str_ref_to_ts(invoice_str.chars, invoice_str.len);
5706         return invoice_conv;
5707 }
5708 uint64_t __attribute__((export_name("TS_LDKPaymentError_Routing_get_routing"))) TS_LDKPaymentError_Routing_get_routing(uint64_t ptr) {
5709         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
5710         assert(obj->tag == LDKPaymentError_Routing);
5711                         LDKLightningError routing_var = obj->routing;
5712                         uint64_t routing_ref = 0;
5713                         CHECK_INNER_FIELD_ACCESS_OR_NULL(routing_var);
5714                         routing_ref = tag_ptr(routing_var.inner, false);
5715         return routing_ref;
5716 }
5717 uint64_t __attribute__((export_name("TS_LDKPaymentError_Sending_get_sending"))) TS_LDKPaymentError_Sending_get_sending(uint64_t ptr) {
5718         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
5719         assert(obj->tag == LDKPaymentError_Sending);
5720                         uint64_t sending_ref = tag_ptr(&obj->sending, false);
5721         return sending_ref;
5722 }
5723 static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentErrorZ_get_ok(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
5724 CHECK(owner->result_ok);
5725         return ThirtyTwoBytes_clone(&*owner->contents.result);
5726 }
5727 int8_tArray  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_get_ok"))) TS_CResult_PaymentIdPaymentErrorZ_get_ok(uint64_t owner) {
5728         LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(owner);
5729         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5730         memcpy(ret_arr->elems, CResult_PaymentIdPaymentErrorZ_get_ok(owner_conv).data, 32);
5731         return ret_arr;
5732 }
5733
5734 static inline struct LDKPaymentError CResult_PaymentIdPaymentErrorZ_get_err(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
5735 CHECK(!owner->result_ok);
5736         return PaymentError_clone(&*owner->contents.err);
5737 }
5738 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_get_err"))) TS_CResult_PaymentIdPaymentErrorZ_get_err(uint64_t owner) {
5739         LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(owner);
5740         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
5741         *ret_copy = CResult_PaymentIdPaymentErrorZ_get_err(owner_conv);
5742         uint64_t ret_ref = tag_ptr(ret_copy, true);
5743         return ret_ref;
5744 }
5745
5746 static inline struct LDKInFlightHtlcs CResult_InFlightHtlcsDecodeErrorZ_get_ok(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
5747         LDKInFlightHtlcs ret = *owner->contents.result;
5748         ret.is_owned = false;
5749         return ret;
5750 }
5751 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_get_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_get_ok(uint64_t owner) {
5752         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
5753         LDKInFlightHtlcs ret_var = CResult_InFlightHtlcsDecodeErrorZ_get_ok(owner_conv);
5754         uint64_t ret_ref = 0;
5755         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5756         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5757         return ret_ref;
5758 }
5759
5760 static inline struct LDKDecodeError CResult_InFlightHtlcsDecodeErrorZ_get_err(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
5761         LDKDecodeError ret = *owner->contents.err;
5762         ret.is_owned = false;
5763         return ret;
5764 }
5765 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_get_err"))) TS_CResult_InFlightHtlcsDecodeErrorZ_get_err(uint64_t owner) {
5766         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
5767         LDKDecodeError ret_var = CResult_InFlightHtlcsDecodeErrorZ_get_err(owner_conv);
5768         uint64_t ret_ref = 0;
5769         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5770         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5771         return ret_ref;
5772 }
5773
5774 uint32_t __attribute__((export_name("TS_LDKParseError_ty_from_ptr"))) TS_LDKParseError_ty_from_ptr(uint64_t ptr) {
5775         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
5776         switch(obj->tag) {
5777                 case LDKParseError_Bech32Error: return 0;
5778                 case LDKParseError_ParseAmountError: return 1;
5779                 case LDKParseError_MalformedSignature: return 2;
5780                 case LDKParseError_BadPrefix: return 3;
5781                 case LDKParseError_UnknownCurrency: return 4;
5782                 case LDKParseError_UnknownSiPrefix: return 5;
5783                 case LDKParseError_MalformedHRP: return 6;
5784                 case LDKParseError_TooShortDataPart: return 7;
5785                 case LDKParseError_UnexpectedEndOfTaggedFields: return 8;
5786                 case LDKParseError_DescriptionDecodeError: return 9;
5787                 case LDKParseError_PaddingError: return 10;
5788                 case LDKParseError_IntegerOverflowError: return 11;
5789                 case LDKParseError_InvalidSegWitProgramLength: return 12;
5790                 case LDKParseError_InvalidPubKeyHashLength: return 13;
5791                 case LDKParseError_InvalidScriptHashLength: return 14;
5792                 case LDKParseError_InvalidRecoveryId: return 15;
5793                 case LDKParseError_InvalidSliceLength: return 16;
5794                 case LDKParseError_Skip: return 17;
5795                 default: abort();
5796         }
5797 }
5798 uint64_t __attribute__((export_name("TS_LDKParseError_Bech32Error_get_bech32_error"))) TS_LDKParseError_Bech32Error_get_bech32_error(uint64_t ptr) {
5799         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
5800         assert(obj->tag == LDKParseError_Bech32Error);
5801                         uint64_t bech32_error_ref = tag_ptr(&obj->bech32_error, false);
5802         return bech32_error_ref;
5803 }
5804 int32_t __attribute__((export_name("TS_LDKParseError_ParseAmountError_get_parse_amount_error"))) TS_LDKParseError_ParseAmountError_get_parse_amount_error(uint64_t ptr) {
5805         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
5806         assert(obj->tag == LDKParseError_ParseAmountError);
5807                         /*obj->parse_amount_error*/
5808         return 0;
5809 }
5810 uint32_t __attribute__((export_name("TS_LDKParseError_MalformedSignature_get_malformed_signature"))) TS_LDKParseError_MalformedSignature_get_malformed_signature(uint64_t ptr) {
5811         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
5812         assert(obj->tag == LDKParseError_MalformedSignature);
5813                         uint32_t malformed_signature_conv = LDKSecp256k1Error_to_js(obj->malformed_signature);
5814         return malformed_signature_conv;
5815 }
5816 int32_t __attribute__((export_name("TS_LDKParseError_DescriptionDecodeError_get_description_decode_error"))) TS_LDKParseError_DescriptionDecodeError_get_description_decode_error(uint64_t ptr) {
5817         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
5818         assert(obj->tag == LDKParseError_DescriptionDecodeError);
5819                         /*obj->description_decode_error*/
5820         return 0;
5821 }
5822 jstring __attribute__((export_name("TS_LDKParseError_InvalidSliceLength_get_invalid_slice_length"))) TS_LDKParseError_InvalidSliceLength_get_invalid_slice_length(uint64_t ptr) {
5823         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
5824         assert(obj->tag == LDKParseError_InvalidSliceLength);
5825                         LDKStr invalid_slice_length_str = obj->invalid_slice_length;
5826                         jstring invalid_slice_length_conv = str_ref_to_ts(invalid_slice_length_str.chars, invalid_slice_length_str.len);
5827         return invalid_slice_length_conv;
5828 }
5829 static inline enum LDKSiPrefix CResult_SiPrefixParseErrorZ_get_ok(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR owner){
5830 CHECK(owner->result_ok);
5831         return SiPrefix_clone(&*owner->contents.result);
5832 }
5833 uint32_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_get_ok"))) TS_CResult_SiPrefixParseErrorZ_get_ok(uint64_t owner) {
5834         LDKCResult_SiPrefixParseErrorZ* owner_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(owner);
5835         uint32_t ret_conv = LDKSiPrefix_to_js(CResult_SiPrefixParseErrorZ_get_ok(owner_conv));
5836         return ret_conv;
5837 }
5838
5839 static inline struct LDKParseError CResult_SiPrefixParseErrorZ_get_err(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR owner){
5840 CHECK(!owner->result_ok);
5841         return ParseError_clone(&*owner->contents.err);
5842 }
5843 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_get_err"))) TS_CResult_SiPrefixParseErrorZ_get_err(uint64_t owner) {
5844         LDKCResult_SiPrefixParseErrorZ* owner_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(owner);
5845         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
5846         *ret_copy = CResult_SiPrefixParseErrorZ_get_err(owner_conv);
5847         uint64_t ret_ref = tag_ptr(ret_copy, true);
5848         return ret_ref;
5849 }
5850
5851 uint32_t __attribute__((export_name("TS_LDKParseOrSemanticError_ty_from_ptr"))) TS_LDKParseOrSemanticError_ty_from_ptr(uint64_t ptr) {
5852         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
5853         switch(obj->tag) {
5854                 case LDKParseOrSemanticError_ParseError: return 0;
5855                 case LDKParseOrSemanticError_SemanticError: return 1;
5856                 default: abort();
5857         }
5858 }
5859 uint64_t __attribute__((export_name("TS_LDKParseOrSemanticError_ParseError_get_parse_error"))) TS_LDKParseOrSemanticError_ParseError_get_parse_error(uint64_t ptr) {
5860         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
5861         assert(obj->tag == LDKParseOrSemanticError_ParseError);
5862                         uint64_t parse_error_ref = tag_ptr(&obj->parse_error, false);
5863         return parse_error_ref;
5864 }
5865 uint32_t __attribute__((export_name("TS_LDKParseOrSemanticError_SemanticError_get_semantic_error"))) TS_LDKParseOrSemanticError_SemanticError_get_semantic_error(uint64_t ptr) {
5866         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
5867         assert(obj->tag == LDKParseOrSemanticError_SemanticError);
5868                         uint32_t semantic_error_conv = LDKSemanticError_to_js(obj->semantic_error);
5869         return semantic_error_conv;
5870 }
5871 static inline struct LDKInvoice CResult_InvoiceParseOrSemanticErrorZ_get_ok(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
5872         LDKInvoice ret = *owner->contents.result;
5873         ret.is_owned = false;
5874         return ret;
5875 }
5876 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_get_ok"))) TS_CResult_InvoiceParseOrSemanticErrorZ_get_ok(uint64_t owner) {
5877         LDKCResult_InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
5878         LDKInvoice ret_var = CResult_InvoiceParseOrSemanticErrorZ_get_ok(owner_conv);
5879         uint64_t ret_ref = 0;
5880         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5881         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5882         return ret_ref;
5883 }
5884
5885 static inline struct LDKParseOrSemanticError CResult_InvoiceParseOrSemanticErrorZ_get_err(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
5886 CHECK(!owner->result_ok);
5887         return ParseOrSemanticError_clone(&*owner->contents.err);
5888 }
5889 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_get_err"))) TS_CResult_InvoiceParseOrSemanticErrorZ_get_err(uint64_t owner) {
5890         LDKCResult_InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
5891         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
5892         *ret_copy = CResult_InvoiceParseOrSemanticErrorZ_get_err(owner_conv);
5893         uint64_t ret_ref = tag_ptr(ret_copy, true);
5894         return ret_ref;
5895 }
5896
5897 static inline struct LDKSignedRawInvoice CResult_SignedRawInvoiceParseErrorZ_get_ok(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR owner){
5898         LDKSignedRawInvoice ret = *owner->contents.result;
5899         ret.is_owned = false;
5900         return ret;
5901 }
5902 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_get_ok"))) TS_CResult_SignedRawInvoiceParseErrorZ_get_ok(uint64_t owner) {
5903         LDKCResult_SignedRawInvoiceParseErrorZ* owner_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(owner);
5904         LDKSignedRawInvoice ret_var = CResult_SignedRawInvoiceParseErrorZ_get_ok(owner_conv);
5905         uint64_t ret_ref = 0;
5906         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5907         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5908         return ret_ref;
5909 }
5910
5911 static inline struct LDKParseError CResult_SignedRawInvoiceParseErrorZ_get_err(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR owner){
5912 CHECK(!owner->result_ok);
5913         return ParseError_clone(&*owner->contents.err);
5914 }
5915 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_get_err"))) TS_CResult_SignedRawInvoiceParseErrorZ_get_err(uint64_t owner) {
5916         LDKCResult_SignedRawInvoiceParseErrorZ* owner_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(owner);
5917         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
5918         *ret_copy = CResult_SignedRawInvoiceParseErrorZ_get_err(owner_conv);
5919         uint64_t ret_ref = tag_ptr(ret_copy, true);
5920         return ret_ref;
5921 }
5922
5923 static inline struct LDKRawInvoice C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
5924         LDKRawInvoice ret = owner->a;
5925         ret.is_owned = false;
5926         return ret;
5927 }
5928 uint64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(uint64_t owner) {
5929         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(owner);
5930         LDKRawInvoice ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(owner_conv);
5931         uint64_t ret_ref = 0;
5932         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5933         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5934         return ret_ref;
5935 }
5936
5937 static inline struct LDKThirtyTwoBytes C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
5938         return ThirtyTwoBytes_clone(&owner->b);
5939 }
5940 int8_tArray  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(uint64_t owner) {
5941         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(owner);
5942         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5943         memcpy(ret_arr->elems, C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(owner_conv).data, 32);
5944         return ret_arr;
5945 }
5946
5947 static inline struct LDKInvoiceSignature C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
5948         LDKInvoiceSignature ret = owner->c;
5949         ret.is_owned = false;
5950         return ret;
5951 }
5952 uint64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(uint64_t owner) {
5953         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(owner);
5954         LDKInvoiceSignature ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(owner_conv);
5955         uint64_t ret_ref = 0;
5956         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5957         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5958         return ret_ref;
5959 }
5960
5961 static inline struct LDKPayeePubKey CResult_PayeePubKeyErrorZ_get_ok(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
5962         LDKPayeePubKey ret = *owner->contents.result;
5963         ret.is_owned = false;
5964         return ret;
5965 }
5966 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_get_ok"))) TS_CResult_PayeePubKeyErrorZ_get_ok(uint64_t owner) {
5967         LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(owner);
5968         LDKPayeePubKey ret_var = CResult_PayeePubKeyErrorZ_get_ok(owner_conv);
5969         uint64_t ret_ref = 0;
5970         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5971         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5972         return ret_ref;
5973 }
5974
5975 static inline enum LDKSecp256k1Error CResult_PayeePubKeyErrorZ_get_err(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
5976 CHECK(!owner->result_ok);
5977         return *owner->contents.err;
5978 }
5979 uint32_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_get_err"))) TS_CResult_PayeePubKeyErrorZ_get_err(uint64_t owner) {
5980         LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(owner);
5981         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_PayeePubKeyErrorZ_get_err(owner_conv));
5982         return ret_conv;
5983 }
5984
5985 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
5986         LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
5987         for (size_t i = 0; i < ret.datalen; i++) {
5988                 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
5989         }
5990         return ret;
5991 }
5992 static inline struct LDKPositiveTimestamp CResult_PositiveTimestampCreationErrorZ_get_ok(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
5993         LDKPositiveTimestamp ret = *owner->contents.result;
5994         ret.is_owned = false;
5995         return ret;
5996 }
5997 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_get_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_get_ok(uint64_t owner) {
5998         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
5999         LDKPositiveTimestamp ret_var = CResult_PositiveTimestampCreationErrorZ_get_ok(owner_conv);
6000         uint64_t ret_ref = 0;
6001         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6002         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6003         return ret_ref;
6004 }
6005
6006 static inline enum LDKCreationError CResult_PositiveTimestampCreationErrorZ_get_err(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
6007 CHECK(!owner->result_ok);
6008         return CreationError_clone(&*owner->contents.err);
6009 }
6010 uint32_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_get_err"))) TS_CResult_PositiveTimestampCreationErrorZ_get_err(uint64_t owner) {
6011         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
6012         uint32_t ret_conv = LDKCreationError_to_js(CResult_PositiveTimestampCreationErrorZ_get_err(owner_conv));
6013         return ret_conv;
6014 }
6015
6016 static inline void CResult_NoneSemanticErrorZ_get_ok(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){
6017 CHECK(owner->result_ok);
6018         return *owner->contents.result;
6019 }
6020 void  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_get_ok"))) TS_CResult_NoneSemanticErrorZ_get_ok(uint64_t owner) {
6021         LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(owner);
6022         CResult_NoneSemanticErrorZ_get_ok(owner_conv);
6023 }
6024
6025 static inline enum LDKSemanticError CResult_NoneSemanticErrorZ_get_err(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){
6026 CHECK(!owner->result_ok);
6027         return SemanticError_clone(&*owner->contents.err);
6028 }
6029 uint32_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_get_err"))) TS_CResult_NoneSemanticErrorZ_get_err(uint64_t owner) {
6030         LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(owner);
6031         uint32_t ret_conv = LDKSemanticError_to_js(CResult_NoneSemanticErrorZ_get_err(owner_conv));
6032         return ret_conv;
6033 }
6034
6035 static inline struct LDKInvoice CResult_InvoiceSemanticErrorZ_get_ok(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){
6036         LDKInvoice ret = *owner->contents.result;
6037         ret.is_owned = false;
6038         return ret;
6039 }
6040 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_get_ok"))) TS_CResult_InvoiceSemanticErrorZ_get_ok(uint64_t owner) {
6041         LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(owner);
6042         LDKInvoice ret_var = CResult_InvoiceSemanticErrorZ_get_ok(owner_conv);
6043         uint64_t ret_ref = 0;
6044         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6045         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6046         return ret_ref;
6047 }
6048
6049 static inline enum LDKSemanticError CResult_InvoiceSemanticErrorZ_get_err(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){
6050 CHECK(!owner->result_ok);
6051         return SemanticError_clone(&*owner->contents.err);
6052 }
6053 uint32_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_get_err"))) TS_CResult_InvoiceSemanticErrorZ_get_err(uint64_t owner) {
6054         LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(owner);
6055         uint32_t ret_conv = LDKSemanticError_to_js(CResult_InvoiceSemanticErrorZ_get_err(owner_conv));
6056         return ret_conv;
6057 }
6058
6059 static inline struct LDKDescription CResult_DescriptionCreationErrorZ_get_ok(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
6060         LDKDescription ret = *owner->contents.result;
6061         ret.is_owned = false;
6062         return ret;
6063 }
6064 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_get_ok"))) TS_CResult_DescriptionCreationErrorZ_get_ok(uint64_t owner) {
6065         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
6066         LDKDescription ret_var = CResult_DescriptionCreationErrorZ_get_ok(owner_conv);
6067         uint64_t ret_ref = 0;
6068         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6069         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6070         return ret_ref;
6071 }
6072
6073 static inline enum LDKCreationError CResult_DescriptionCreationErrorZ_get_err(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
6074 CHECK(!owner->result_ok);
6075         return CreationError_clone(&*owner->contents.err);
6076 }
6077 uint32_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_get_err"))) TS_CResult_DescriptionCreationErrorZ_get_err(uint64_t owner) {
6078         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
6079         uint32_t ret_conv = LDKCreationError_to_js(CResult_DescriptionCreationErrorZ_get_err(owner_conv));
6080         return ret_conv;
6081 }
6082
6083 static inline struct LDKPrivateRoute CResult_PrivateRouteCreationErrorZ_get_ok(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
6084         LDKPrivateRoute ret = *owner->contents.result;
6085         ret.is_owned = false;
6086         return ret;
6087 }
6088 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_get_ok"))) TS_CResult_PrivateRouteCreationErrorZ_get_ok(uint64_t owner) {
6089         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
6090         LDKPrivateRoute ret_var = CResult_PrivateRouteCreationErrorZ_get_ok(owner_conv);
6091         uint64_t ret_ref = 0;
6092         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6093         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6094         return ret_ref;
6095 }
6096
6097 static inline enum LDKCreationError CResult_PrivateRouteCreationErrorZ_get_err(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
6098 CHECK(!owner->result_ok);
6099         return CreationError_clone(&*owner->contents.err);
6100 }
6101 uint32_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_get_err"))) TS_CResult_PrivateRouteCreationErrorZ_get_err(uint64_t owner) {
6102         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
6103         uint32_t ret_conv = LDKCreationError_to_js(CResult_PrivateRouteCreationErrorZ_get_err(owner_conv));
6104         return ret_conv;
6105 }
6106
6107 static inline struct LDKStr CResult_StringErrorZ_get_ok(LDKCResult_StringErrorZ *NONNULL_PTR owner){
6108 CHECK(owner->result_ok);
6109         return *owner->contents.result;
6110 }
6111 jstring  __attribute__((export_name("TS_CResult_StringErrorZ_get_ok"))) TS_CResult_StringErrorZ_get_ok(uint64_t owner) {
6112         LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)untag_ptr(owner);
6113         LDKStr ret_str = CResult_StringErrorZ_get_ok(owner_conv);
6114         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
6115         return ret_conv;
6116 }
6117
6118 static inline enum LDKSecp256k1Error CResult_StringErrorZ_get_err(LDKCResult_StringErrorZ *NONNULL_PTR owner){
6119 CHECK(!owner->result_ok);
6120         return *owner->contents.err;
6121 }
6122 uint32_t  __attribute__((export_name("TS_CResult_StringErrorZ_get_err"))) TS_CResult_StringErrorZ_get_err(uint64_t owner) {
6123         LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)untag_ptr(owner);
6124         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_StringErrorZ_get_err(owner_conv));
6125         return ret_conv;
6126 }
6127
6128 static inline struct LDKChannelMonitorUpdate CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
6129         LDKChannelMonitorUpdate ret = *owner->contents.result;
6130         ret.is_owned = false;
6131         return ret;
6132 }
6133 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(uint64_t owner) {
6134         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
6135         LDKChannelMonitorUpdate ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(owner_conv);
6136         uint64_t ret_ref = 0;
6137         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6138         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6139         return ret_ref;
6140 }
6141
6142 static inline struct LDKDecodeError CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
6143         LDKDecodeError ret = *owner->contents.err;
6144         ret.is_owned = false;
6145         return ret;
6146 }
6147 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(uint64_t owner) {
6148         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
6149         LDKDecodeError ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(owner_conv);
6150         uint64_t ret_ref = 0;
6151         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6152         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6153         return ret_ref;
6154 }
6155
6156 uint32_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_ty_from_ptr"))) TS_LDKCOption_MonitorEventZ_ty_from_ptr(uint64_t ptr) {
6157         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
6158         switch(obj->tag) {
6159                 case LDKCOption_MonitorEventZ_Some: return 0;
6160                 case LDKCOption_MonitorEventZ_None: return 1;
6161                 default: abort();
6162         }
6163 }
6164 uint64_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_Some_get_some"))) TS_LDKCOption_MonitorEventZ_Some_get_some(uint64_t ptr) {
6165         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
6166         assert(obj->tag == LDKCOption_MonitorEventZ_Some);
6167                         uint64_t some_ref = tag_ptr(&obj->some, false);
6168         return some_ref;
6169 }
6170 static inline struct LDKCOption_MonitorEventZ CResult_COption_MonitorEventZDecodeErrorZ_get_ok(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
6171 CHECK(owner->result_ok);
6172         return COption_MonitorEventZ_clone(&*owner->contents.result);
6173 }
6174 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok(uint64_t owner) {
6175         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
6176         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
6177         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_ok(owner_conv);
6178         uint64_t ret_ref = tag_ptr(ret_copy, true);
6179         return ret_ref;
6180 }
6181
6182 static inline struct LDKDecodeError CResult_COption_MonitorEventZDecodeErrorZ_get_err(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
6183         LDKDecodeError ret = *owner->contents.err;
6184         ret.is_owned = false;
6185         return ret;
6186 }
6187 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err(uint64_t owner) {
6188         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
6189         LDKDecodeError ret_var = CResult_COption_MonitorEventZDecodeErrorZ_get_err(owner_conv);
6190         uint64_t ret_ref = 0;
6191         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6192         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6193         return ret_ref;
6194 }
6195
6196 static inline struct LDKHTLCUpdate CResult_HTLCUpdateDecodeErrorZ_get_ok(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
6197         LDKHTLCUpdate ret = *owner->contents.result;
6198         ret.is_owned = false;
6199         return ret;
6200 }
6201 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_ok(uint64_t owner) {
6202         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
6203         LDKHTLCUpdate ret_var = CResult_HTLCUpdateDecodeErrorZ_get_ok(owner_conv);
6204         uint64_t ret_ref = 0;
6205         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6206         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6207         return ret_ref;
6208 }
6209
6210 static inline struct LDKDecodeError CResult_HTLCUpdateDecodeErrorZ_get_err(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
6211         LDKDecodeError ret = *owner->contents.err;
6212         ret.is_owned = false;
6213         return ret;
6214 }
6215 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_err(uint64_t owner) {
6216         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
6217         LDKDecodeError ret_var = CResult_HTLCUpdateDecodeErrorZ_get_err(owner_conv);
6218         uint64_t ret_ref = 0;
6219         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6220         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6221         return ret_ref;
6222 }
6223
6224 static inline struct LDKOutPoint C2Tuple_OutPointScriptZ_get_a(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
6225         LDKOutPoint ret = owner->a;
6226         ret.is_owned = false;
6227         return ret;
6228 }
6229 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_get_a"))) TS_C2Tuple_OutPointScriptZ_get_a(uint64_t owner) {
6230         LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(owner);
6231         LDKOutPoint ret_var = C2Tuple_OutPointScriptZ_get_a(owner_conv);
6232         uint64_t ret_ref = 0;
6233         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6234         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6235         return ret_ref;
6236 }
6237
6238 static inline struct LDKCVec_u8Z C2Tuple_OutPointScriptZ_get_b(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
6239         return CVec_u8Z_clone(&owner->b);
6240 }
6241 int8_tArray  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_get_b"))) TS_C2Tuple_OutPointScriptZ_get_b(uint64_t owner) {
6242         LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(owner);
6243         LDKCVec_u8Z ret_var = C2Tuple_OutPointScriptZ_get_b(owner_conv);
6244         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6245         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6246         CVec_u8Z_free(ret_var);
6247         return ret_arr;
6248 }
6249
6250 static inline uint32_t C2Tuple_u32ScriptZ_get_a(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
6251         return owner->a;
6252 }
6253 int32_t  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_get_a"))) TS_C2Tuple_u32ScriptZ_get_a(uint64_t owner) {
6254         LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(owner);
6255         int32_t ret_conv = C2Tuple_u32ScriptZ_get_a(owner_conv);
6256         return ret_conv;
6257 }
6258
6259 static inline struct LDKCVec_u8Z C2Tuple_u32ScriptZ_get_b(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
6260         return CVec_u8Z_clone(&owner->b);
6261 }
6262 int8_tArray  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_get_b"))) TS_C2Tuple_u32ScriptZ_get_b(uint64_t owner) {
6263         LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(owner);
6264         LDKCVec_u8Z ret_var = C2Tuple_u32ScriptZ_get_b(owner_conv);
6265         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6266         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6267         CVec_u8Z_free(ret_var);
6268         return ret_arr;
6269 }
6270
6271 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
6272         LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
6273         for (size_t i = 0; i < ret.datalen; i++) {
6274                 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
6275         }
6276         return ret;
6277 }
6278 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
6279         return ThirtyTwoBytes_clone(&owner->a);
6280 }
6281 int8_tArray  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(uint64_t owner) {
6282         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(owner);
6283         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6284         memcpy(ret_arr->elems, C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(owner_conv).data, 32);
6285         return ret_arr;
6286 }
6287
6288 static inline struct LDKCVec_C2Tuple_u32ScriptZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
6289         return CVec_C2Tuple_u32ScriptZZ_clone(&owner->b);
6290 }
6291 uint64_tArray  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(uint64_t owner) {
6292         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(owner);
6293         LDKCVec_C2Tuple_u32ScriptZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(owner_conv);
6294         uint64_tArray ret_arr = NULL;
6295         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
6296         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
6297         for (size_t v = 0; v < ret_var.datalen; v++) {
6298                 LDKC2Tuple_u32ScriptZ* ret_conv_21_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
6299                 *ret_conv_21_conv = ret_var.data[v];
6300                 ret_arr_ptr[v] = tag_ptr(ret_conv_21_conv, true);
6301         }
6302         
6303         FREE(ret_var.data);
6304         return ret_arr;
6305 }
6306
6307 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
6308         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 };
6309         for (size_t i = 0; i < ret.datalen; i++) {
6310                 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
6311         }
6312         return ret;
6313 }
6314 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
6315         LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
6316         for (size_t i = 0; i < ret.datalen; i++) {
6317                 ret.data[i] = Event_clone(&orig->data[i]);
6318         }
6319         return ret;
6320 }
6321 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
6322         return owner->a;
6323 }
6324 int32_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_get_a"))) TS_C2Tuple_u32TxOutZ_get_a(uint64_t owner) {
6325         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
6326         int32_t ret_conv = C2Tuple_u32TxOutZ_get_a(owner_conv);
6327         return ret_conv;
6328 }
6329
6330 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
6331         return TxOut_clone(&owner->b);
6332 }
6333 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_get_b"))) TS_C2Tuple_u32TxOutZ_get_b(uint64_t owner) {
6334         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
6335         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
6336         *ret_ref = C2Tuple_u32TxOutZ_get_b(owner_conv);
6337         return tag_ptr(ret_ref, true);
6338 }
6339
6340 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
6341         LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
6342         for (size_t i = 0; i < ret.datalen; i++) {
6343                 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
6344         }
6345         return ret;
6346 }
6347 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
6348         return ThirtyTwoBytes_clone(&owner->a);
6349 }
6350 int8_tArray  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(uint64_t owner) {
6351         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
6352         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6353         memcpy(ret_arr->elems, C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(owner_conv).data, 32);
6354         return ret_arr;
6355 }
6356
6357 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
6358         return CVec_C2Tuple_u32TxOutZZ_clone(&owner->b);
6359 }
6360 uint64_tArray  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(uint64_t owner) {
6361         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
6362         LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(owner_conv);
6363         uint64_tArray ret_arr = NULL;
6364         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
6365         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
6366         for (size_t u = 0; u < ret_var.datalen; u++) {
6367                 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
6368                 *ret_conv_20_conv = ret_var.data[u];
6369                 ret_arr_ptr[u] = tag_ptr(ret_conv_20_conv, true);
6370         }
6371         
6372         FREE(ret_var.data);
6373         return ret_arr;
6374 }
6375
6376 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
6377         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 };
6378         for (size_t i = 0; i < ret.datalen; i++) {
6379                 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
6380         }
6381         return ret;
6382 }
6383 uint32_t __attribute__((export_name("TS_LDKBalance_ty_from_ptr"))) TS_LDKBalance_ty_from_ptr(uint64_t ptr) {
6384         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6385         switch(obj->tag) {
6386                 case LDKBalance_ClaimableOnChannelClose: return 0;
6387                 case LDKBalance_ClaimableAwaitingConfirmations: return 1;
6388                 case LDKBalance_ContentiousClaimable: return 2;
6389                 case LDKBalance_MaybeTimeoutClaimableHTLC: return 3;
6390                 case LDKBalance_MaybePreimageClaimableHTLC: return 4;
6391                 case LDKBalance_CounterpartyRevokedOutputClaimable: return 5;
6392                 default: abort();
6393         }
6394 }
6395 int64_t __attribute__((export_name("TS_LDKBalance_ClaimableOnChannelClose_get_claimable_amount_satoshis"))) TS_LDKBalance_ClaimableOnChannelClose_get_claimable_amount_satoshis(uint64_t ptr) {
6396         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6397         assert(obj->tag == LDKBalance_ClaimableOnChannelClose);
6398                         int64_t claimable_amount_satoshis_conv = obj->claimable_on_channel_close.claimable_amount_satoshis;
6399         return claimable_amount_satoshis_conv;
6400 }
6401 int64_t __attribute__((export_name("TS_LDKBalance_ClaimableAwaitingConfirmations_get_claimable_amount_satoshis"))) TS_LDKBalance_ClaimableAwaitingConfirmations_get_claimable_amount_satoshis(uint64_t ptr) {
6402         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6403         assert(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
6404                         int64_t claimable_amount_satoshis_conv = obj->claimable_awaiting_confirmations.claimable_amount_satoshis;
6405         return claimable_amount_satoshis_conv;
6406 }
6407 int32_t __attribute__((export_name("TS_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height"))) TS_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height(uint64_t ptr) {
6408         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6409         assert(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
6410                         int32_t confirmation_height_conv = obj->claimable_awaiting_confirmations.confirmation_height;
6411         return confirmation_height_conv;
6412 }
6413 int64_t __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_claimable_amount_satoshis"))) TS_LDKBalance_ContentiousClaimable_get_claimable_amount_satoshis(uint64_t ptr) {
6414         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6415         assert(obj->tag == LDKBalance_ContentiousClaimable);
6416                         int64_t claimable_amount_satoshis_conv = obj->contentious_claimable.claimable_amount_satoshis;
6417         return claimable_amount_satoshis_conv;
6418 }
6419 int32_t __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_timeout_height"))) TS_LDKBalance_ContentiousClaimable_get_timeout_height(uint64_t ptr) {
6420         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6421         assert(obj->tag == LDKBalance_ContentiousClaimable);
6422                         int32_t timeout_height_conv = obj->contentious_claimable.timeout_height;
6423         return timeout_height_conv;
6424 }
6425 int64_t __attribute__((export_name("TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_amount_satoshis"))) TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_amount_satoshis(uint64_t ptr) {
6426         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6427         assert(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
6428                         int64_t claimable_amount_satoshis_conv = obj->maybe_timeout_claimable_htlc.claimable_amount_satoshis;
6429         return claimable_amount_satoshis_conv;
6430 }
6431 int32_t __attribute__((export_name("TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_height"))) TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_height(uint64_t ptr) {
6432         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6433         assert(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
6434                         int32_t claimable_height_conv = obj->maybe_timeout_claimable_htlc.claimable_height;
6435         return claimable_height_conv;
6436 }
6437 int64_t __attribute__((export_name("TS_LDKBalance_MaybePreimageClaimableHTLC_get_claimable_amount_satoshis"))) TS_LDKBalance_MaybePreimageClaimableHTLC_get_claimable_amount_satoshis(uint64_t ptr) {
6438         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6439         assert(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
6440                         int64_t claimable_amount_satoshis_conv = obj->maybe_preimage_claimable_htlc.claimable_amount_satoshis;
6441         return claimable_amount_satoshis_conv;
6442 }
6443 int32_t __attribute__((export_name("TS_LDKBalance_MaybePreimageClaimableHTLC_get_expiry_height"))) TS_LDKBalance_MaybePreimageClaimableHTLC_get_expiry_height(uint64_t ptr) {
6444         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6445         assert(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
6446                         int32_t expiry_height_conv = obj->maybe_preimage_claimable_htlc.expiry_height;
6447         return expiry_height_conv;
6448 }
6449 int64_t __attribute__((export_name("TS_LDKBalance_CounterpartyRevokedOutputClaimable_get_claimable_amount_satoshis"))) TS_LDKBalance_CounterpartyRevokedOutputClaimable_get_claimable_amount_satoshis(uint64_t ptr) {
6450         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6451         assert(obj->tag == LDKBalance_CounterpartyRevokedOutputClaimable);
6452                         int64_t claimable_amount_satoshis_conv = obj->counterparty_revoked_output_claimable.claimable_amount_satoshis;
6453         return claimable_amount_satoshis_conv;
6454 }
6455 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
6456         LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
6457         for (size_t i = 0; i < ret.datalen; i++) {
6458                 ret.data[i] = Balance_clone(&orig->data[i]);
6459         }
6460         return ret;
6461 }
6462 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelMonitorZ_get_a(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
6463         return ThirtyTwoBytes_clone(&owner->a);
6464 }
6465 int8_tArray  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_get_a"))) TS_C2Tuple_BlockHashChannelMonitorZ_get_a(uint64_t owner) {
6466         LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(owner);
6467         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6468         memcpy(ret_arr->elems, C2Tuple_BlockHashChannelMonitorZ_get_a(owner_conv).data, 32);
6469         return ret_arr;
6470 }
6471
6472 static inline struct LDKChannelMonitor C2Tuple_BlockHashChannelMonitorZ_get_b(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
6473         LDKChannelMonitor ret = owner->b;
6474         ret.is_owned = false;
6475         return ret;
6476 }
6477 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_get_b"))) TS_C2Tuple_BlockHashChannelMonitorZ_get_b(uint64_t owner) {
6478         LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(owner);
6479         LDKChannelMonitor ret_var = C2Tuple_BlockHashChannelMonitorZ_get_b(owner_conv);
6480         uint64_t ret_ref = 0;
6481         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6482         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6483         return ret_ref;
6484 }
6485
6486 static inline struct LDKC2Tuple_BlockHashChannelMonitorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
6487 CHECK(owner->result_ok);
6488         return C2Tuple_BlockHashChannelMonitorZ_clone(&*owner->contents.result);
6489 }
6490 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(uint64_t owner) {
6491         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
6492         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
6493         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(owner_conv);
6494         return tag_ptr(ret_conv, true);
6495 }
6496
6497 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
6498         LDKDecodeError ret = *owner->contents.err;
6499         ret.is_owned = false;
6500         return ret;
6501 }
6502 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(uint64_t owner) {
6503         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
6504         LDKDecodeError ret_var = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(owner_conv);
6505         uint64_t ret_ref = 0;
6506         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6507         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6508         return ret_ref;
6509 }
6510
6511 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
6512         return owner->a;
6513 }
6514 int8_tArray  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_get_a"))) TS_C2Tuple_PublicKeyTypeZ_get_a(uint64_t owner) {
6515         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
6516         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
6517         memcpy(ret_arr->elems, C2Tuple_PublicKeyTypeZ_get_a(owner_conv).compressed_form, 33);
6518         return ret_arr;
6519 }
6520
6521 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
6522         return Type_clone(&owner->b);
6523 }
6524 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_get_b"))) TS_C2Tuple_PublicKeyTypeZ_get_b(uint64_t owner) {
6525         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
6526         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
6527         *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(owner_conv);
6528         return tag_ptr(ret_ret, true);
6529 }
6530
6531 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
6532         LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
6533         for (size_t i = 0; i < ret.datalen; i++) {
6534                 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
6535         }
6536         return ret;
6537 }
6538 uint32_t __attribute__((export_name("TS_LDKCOption_NetAddressZ_ty_from_ptr"))) TS_LDKCOption_NetAddressZ_ty_from_ptr(uint64_t ptr) {
6539         LDKCOption_NetAddressZ *obj = (LDKCOption_NetAddressZ*)untag_ptr(ptr);
6540         switch(obj->tag) {
6541                 case LDKCOption_NetAddressZ_Some: return 0;
6542                 case LDKCOption_NetAddressZ_None: return 1;
6543                 default: abort();
6544         }
6545 }
6546 uint64_t __attribute__((export_name("TS_LDKCOption_NetAddressZ_Some_get_some"))) TS_LDKCOption_NetAddressZ_Some_get_some(uint64_t ptr) {
6547         LDKCOption_NetAddressZ *obj = (LDKCOption_NetAddressZ*)untag_ptr(ptr);
6548         assert(obj->tag == LDKCOption_NetAddressZ_Some);
6549                         uint64_t some_ref = tag_ptr(&obj->some, false);
6550         return some_ref;
6551 }
6552 static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
6553 CHECK(owner->result_ok);
6554         return CVec_u8Z_clone(&*owner->contents.result);
6555 }
6556 int8_tArray  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_get_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_ok(uint64_t owner) {
6557         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
6558         LDKCVec_u8Z ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_ok(owner_conv);
6559         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6560         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6561         CVec_u8Z_free(ret_var);
6562         return ret_arr;
6563 }
6564
6565 static inline struct LDKPeerHandleError CResult_CVec_u8ZPeerHandleErrorZ_get_err(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
6566         LDKPeerHandleError ret = *owner->contents.err;
6567         ret.is_owned = false;
6568         return ret;
6569 }
6570 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_get_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_err(uint64_t owner) {
6571         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
6572         LDKPeerHandleError ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_err(owner_conv);
6573         uint64_t ret_ref = 0;
6574         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6575         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6576         return ret_ref;
6577 }
6578
6579 static inline void CResult_NonePeerHandleErrorZ_get_ok(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
6580 CHECK(owner->result_ok);
6581         return *owner->contents.result;
6582 }
6583 void  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_get_ok"))) TS_CResult_NonePeerHandleErrorZ_get_ok(uint64_t owner) {
6584         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
6585         CResult_NonePeerHandleErrorZ_get_ok(owner_conv);
6586 }
6587
6588 static inline struct LDKPeerHandleError CResult_NonePeerHandleErrorZ_get_err(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
6589         LDKPeerHandleError ret = *owner->contents.err;
6590         ret.is_owned = false;
6591         return ret;
6592 }
6593 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_get_err"))) TS_CResult_NonePeerHandleErrorZ_get_err(uint64_t owner) {
6594         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
6595         LDKPeerHandleError ret_var = CResult_NonePeerHandleErrorZ_get_err(owner_conv);
6596         uint64_t ret_ref = 0;
6597         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6598         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6599         return ret_ref;
6600 }
6601
6602 static inline bool CResult_boolPeerHandleErrorZ_get_ok(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
6603 CHECK(owner->result_ok);
6604         return *owner->contents.result;
6605 }
6606 jboolean  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_get_ok"))) TS_CResult_boolPeerHandleErrorZ_get_ok(uint64_t owner) {
6607         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
6608         jboolean ret_conv = CResult_boolPeerHandleErrorZ_get_ok(owner_conv);
6609         return ret_conv;
6610 }
6611
6612 static inline struct LDKPeerHandleError CResult_boolPeerHandleErrorZ_get_err(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
6613         LDKPeerHandleError ret = *owner->contents.err;
6614         ret.is_owned = false;
6615         return ret;
6616 }
6617 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_get_err"))) TS_CResult_boolPeerHandleErrorZ_get_err(uint64_t owner) {
6618         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
6619         LDKPeerHandleError ret_var = CResult_boolPeerHandleErrorZ_get_err(owner_conv);
6620         uint64_t ret_ref = 0;
6621         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6622         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6623         return ret_ref;
6624 }
6625
6626 uint32_t __attribute__((export_name("TS_LDKSendError_ty_from_ptr"))) TS_LDKSendError_ty_from_ptr(uint64_t ptr) {
6627         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
6628         switch(obj->tag) {
6629                 case LDKSendError_Secp256k1: return 0;
6630                 case LDKSendError_TooBigPacket: return 1;
6631                 case LDKSendError_TooFewBlindedHops: return 2;
6632                 case LDKSendError_InvalidFirstHop: return 3;
6633                 case LDKSendError_BufferFull: return 4;
6634                 default: abort();
6635         }
6636 }
6637 uint32_t __attribute__((export_name("TS_LDKSendError_Secp256k1_get_secp256k1"))) TS_LDKSendError_Secp256k1_get_secp256k1(uint64_t ptr) {
6638         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
6639         assert(obj->tag == LDKSendError_Secp256k1);
6640                         uint32_t secp256k1_conv = LDKSecp256k1Error_to_js(obj->secp256k1);
6641         return secp256k1_conv;
6642 }
6643 static inline void CResult_NoneSendErrorZ_get_ok(LDKCResult_NoneSendErrorZ *NONNULL_PTR owner){
6644 CHECK(owner->result_ok);
6645         return *owner->contents.result;
6646 }
6647 void  __attribute__((export_name("TS_CResult_NoneSendErrorZ_get_ok"))) TS_CResult_NoneSendErrorZ_get_ok(uint64_t owner) {
6648         LDKCResult_NoneSendErrorZ* owner_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(owner);
6649         CResult_NoneSendErrorZ_get_ok(owner_conv);
6650 }
6651
6652 static inline struct LDKSendError CResult_NoneSendErrorZ_get_err(LDKCResult_NoneSendErrorZ *NONNULL_PTR owner){
6653 CHECK(!owner->result_ok);
6654         return SendError_clone(&*owner->contents.err);
6655 }
6656 uint64_t  __attribute__((export_name("TS_CResult_NoneSendErrorZ_get_err"))) TS_CResult_NoneSendErrorZ_get_err(uint64_t owner) {
6657         LDKCResult_NoneSendErrorZ* owner_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(owner);
6658         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
6659         *ret_copy = CResult_NoneSendErrorZ_get_err(owner_conv);
6660         uint64_t ret_ref = tag_ptr(ret_copy, true);
6661         return ret_ref;
6662 }
6663
6664 uint32_t __attribute__((export_name("TS_LDKGraphSyncError_ty_from_ptr"))) TS_LDKGraphSyncError_ty_from_ptr(uint64_t ptr) {
6665         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
6666         switch(obj->tag) {
6667                 case LDKGraphSyncError_DecodeError: return 0;
6668                 case LDKGraphSyncError_LightningError: return 1;
6669                 default: abort();
6670         }
6671 }
6672 uint64_t __attribute__((export_name("TS_LDKGraphSyncError_DecodeError_get_decode_error"))) TS_LDKGraphSyncError_DecodeError_get_decode_error(uint64_t ptr) {
6673         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
6674         assert(obj->tag == LDKGraphSyncError_DecodeError);
6675                         LDKDecodeError decode_error_var = obj->decode_error;
6676                         uint64_t decode_error_ref = 0;
6677                         CHECK_INNER_FIELD_ACCESS_OR_NULL(decode_error_var);
6678                         decode_error_ref = tag_ptr(decode_error_var.inner, false);
6679         return decode_error_ref;
6680 }
6681 uint64_t __attribute__((export_name("TS_LDKGraphSyncError_LightningError_get_lightning_error"))) TS_LDKGraphSyncError_LightningError_get_lightning_error(uint64_t ptr) {
6682         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
6683         assert(obj->tag == LDKGraphSyncError_LightningError);
6684                         LDKLightningError lightning_error_var = obj->lightning_error;
6685                         uint64_t lightning_error_ref = 0;
6686                         CHECK_INNER_FIELD_ACCESS_OR_NULL(lightning_error_var);
6687                         lightning_error_ref = tag_ptr(lightning_error_var.inner, false);
6688         return lightning_error_ref;
6689 }
6690 static inline uint32_t CResult_u32GraphSyncErrorZ_get_ok(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
6691 CHECK(owner->result_ok);
6692         return *owner->contents.result;
6693 }
6694 int32_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_get_ok"))) TS_CResult_u32GraphSyncErrorZ_get_ok(uint64_t owner) {
6695         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
6696         int32_t ret_conv = CResult_u32GraphSyncErrorZ_get_ok(owner_conv);
6697         return ret_conv;
6698 }
6699
6700 static inline struct LDKGraphSyncError CResult_u32GraphSyncErrorZ_get_err(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
6701 CHECK(!owner->result_ok);
6702         return GraphSyncError_clone(&*owner->contents.err);
6703 }
6704 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_get_err"))) TS_CResult_u32GraphSyncErrorZ_get_err(uint64_t owner) {
6705         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
6706         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
6707         *ret_copy = CResult_u32GraphSyncErrorZ_get_err(owner_conv);
6708         uint64_t ret_ref = tag_ptr(ret_copy, true);
6709         return ret_ref;
6710 }
6711
6712 static inline void CResult_NoneErrorZ_get_ok(LDKCResult_NoneErrorZ *NONNULL_PTR owner){
6713 CHECK(owner->result_ok);
6714         return *owner->contents.result;
6715 }
6716 void  __attribute__((export_name("TS_CResult_NoneErrorZ_get_ok"))) TS_CResult_NoneErrorZ_get_ok(uint64_t owner) {
6717         LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)untag_ptr(owner);
6718         CResult_NoneErrorZ_get_ok(owner_conv);
6719 }
6720
6721 static inline enum LDKIOError CResult_NoneErrorZ_get_err(LDKCResult_NoneErrorZ *NONNULL_PTR owner){
6722 CHECK(!owner->result_ok);
6723         return *owner->contents.err;
6724 }
6725 uint32_t  __attribute__((export_name("TS_CResult_NoneErrorZ_get_err"))) TS_CResult_NoneErrorZ_get_err(uint64_t owner) {
6726         LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)untag_ptr(owner);
6727         uint32_t ret_conv = LDKIOError_to_js(CResult_NoneErrorZ_get_err(owner_conv));
6728         return ret_conv;
6729 }
6730
6731 static inline struct LDKNetAddress CResult_NetAddressDecodeErrorZ_get_ok(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
6732 CHECK(owner->result_ok);
6733         return NetAddress_clone(&*owner->contents.result);
6734 }
6735 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_get_ok"))) TS_CResult_NetAddressDecodeErrorZ_get_ok(uint64_t owner) {
6736         LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(owner);
6737         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
6738         *ret_copy = CResult_NetAddressDecodeErrorZ_get_ok(owner_conv);
6739         uint64_t ret_ref = tag_ptr(ret_copy, true);
6740         return ret_ref;
6741 }
6742
6743 static inline struct LDKDecodeError CResult_NetAddressDecodeErrorZ_get_err(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
6744         LDKDecodeError ret = *owner->contents.err;
6745         ret.is_owned = false;
6746         return ret;
6747 }
6748 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_get_err"))) TS_CResult_NetAddressDecodeErrorZ_get_err(uint64_t owner) {
6749         LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(owner);
6750         LDKDecodeError ret_var = CResult_NetAddressDecodeErrorZ_get_err(owner_conv);
6751         uint64_t ret_ref = 0;
6752         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6753         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6754         return ret_ref;
6755 }
6756
6757 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
6758         LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
6759         for (size_t i = 0; i < ret.datalen; i++) {
6760                 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
6761         }
6762         return ret;
6763 }
6764 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
6765         LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
6766         for (size_t i = 0; i < ret.datalen; i++) {
6767                 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
6768         }
6769         return ret;
6770 }
6771 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
6772         LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
6773         for (size_t i = 0; i < ret.datalen; i++) {
6774                 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
6775         }
6776         return ret;
6777 }
6778 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
6779         LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
6780         for (size_t i = 0; i < ret.datalen; i++) {
6781                 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
6782         }
6783         return ret;
6784 }
6785 static inline struct LDKAcceptChannel CResult_AcceptChannelDecodeErrorZ_get_ok(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
6786         LDKAcceptChannel ret = *owner->contents.result;
6787         ret.is_owned = false;
6788         return ret;
6789 }
6790 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_get_ok(uint64_t owner) {
6791         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
6792         LDKAcceptChannel ret_var = CResult_AcceptChannelDecodeErrorZ_get_ok(owner_conv);
6793         uint64_t ret_ref = 0;
6794         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6795         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6796         return ret_ref;
6797 }
6798
6799 static inline struct LDKDecodeError CResult_AcceptChannelDecodeErrorZ_get_err(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
6800         LDKDecodeError ret = *owner->contents.err;
6801         ret.is_owned = false;
6802         return ret;
6803 }
6804 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_err"))) TS_CResult_AcceptChannelDecodeErrorZ_get_err(uint64_t owner) {
6805         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
6806         LDKDecodeError ret_var = CResult_AcceptChannelDecodeErrorZ_get_err(owner_conv);
6807         uint64_t ret_ref = 0;
6808         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6809         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6810         return ret_ref;
6811 }
6812
6813 static inline struct LDKAnnouncementSignatures CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
6814         LDKAnnouncementSignatures ret = *owner->contents.result;
6815         ret.is_owned = false;
6816         return ret;
6817 }
6818 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(uint64_t owner) {
6819         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
6820         LDKAnnouncementSignatures ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(owner_conv);
6821         uint64_t ret_ref = 0;
6822         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6823         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6824         return ret_ref;
6825 }
6826
6827 static inline struct LDKDecodeError CResult_AnnouncementSignaturesDecodeErrorZ_get_err(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
6828         LDKDecodeError ret = *owner->contents.err;
6829         ret.is_owned = false;
6830         return ret;
6831 }
6832 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err(uint64_t owner) {
6833         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
6834         LDKDecodeError ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_err(owner_conv);
6835         uint64_t ret_ref = 0;
6836         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6837         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6838         return ret_ref;
6839 }
6840
6841 static inline struct LDKChannelReestablish CResult_ChannelReestablishDecodeErrorZ_get_ok(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
6842         LDKChannelReestablish ret = *owner->contents.result;
6843         ret.is_owned = false;
6844         return ret;
6845 }
6846 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_ok(uint64_t owner) {
6847         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
6848         LDKChannelReestablish ret_var = CResult_ChannelReestablishDecodeErrorZ_get_ok(owner_conv);
6849         uint64_t ret_ref = 0;
6850         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6851         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6852         return ret_ref;
6853 }
6854
6855 static inline struct LDKDecodeError CResult_ChannelReestablishDecodeErrorZ_get_err(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
6856         LDKDecodeError ret = *owner->contents.err;
6857         ret.is_owned = false;
6858         return ret;
6859 }
6860 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_err(uint64_t owner) {
6861         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
6862         LDKDecodeError ret_var = CResult_ChannelReestablishDecodeErrorZ_get_err(owner_conv);
6863         uint64_t ret_ref = 0;
6864         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6865         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6866         return ret_ref;
6867 }
6868
6869 static inline struct LDKClosingSigned CResult_ClosingSignedDecodeErrorZ_get_ok(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
6870         LDKClosingSigned ret = *owner->contents.result;
6871         ret.is_owned = false;
6872         return ret;
6873 }
6874 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_get_ok(uint64_t owner) {
6875         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
6876         LDKClosingSigned ret_var = CResult_ClosingSignedDecodeErrorZ_get_ok(owner_conv);
6877         uint64_t ret_ref = 0;
6878         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6879         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6880         return ret_ref;
6881 }
6882
6883 static inline struct LDKDecodeError CResult_ClosingSignedDecodeErrorZ_get_err(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
6884         LDKDecodeError ret = *owner->contents.err;
6885         ret.is_owned = false;
6886         return ret;
6887 }
6888 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedDecodeErrorZ_get_err(uint64_t owner) {
6889         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
6890         LDKDecodeError ret_var = CResult_ClosingSignedDecodeErrorZ_get_err(owner_conv);
6891         uint64_t ret_ref = 0;
6892         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6893         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6894         return ret_ref;
6895 }
6896
6897 static inline struct LDKClosingSignedFeeRange CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
6898         LDKClosingSignedFeeRange ret = *owner->contents.result;
6899         ret.is_owned = false;
6900         return ret;
6901 }
6902 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(uint64_t owner) {
6903         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
6904         LDKClosingSignedFeeRange ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(owner_conv);
6905         uint64_t ret_ref = 0;
6906         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6907         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6908         return ret_ref;
6909 }
6910
6911 static inline struct LDKDecodeError CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
6912         LDKDecodeError ret = *owner->contents.err;
6913         ret.is_owned = false;
6914         return ret;
6915 }
6916 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(uint64_t owner) {
6917         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
6918         LDKDecodeError ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(owner_conv);
6919         uint64_t ret_ref = 0;
6920         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6921         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6922         return ret_ref;
6923 }
6924
6925 static inline struct LDKCommitmentSigned CResult_CommitmentSignedDecodeErrorZ_get_ok(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
6926         LDKCommitmentSigned ret = *owner->contents.result;
6927         ret.is_owned = false;
6928         return ret;
6929 }
6930 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_get_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_ok(uint64_t owner) {
6931         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
6932         LDKCommitmentSigned ret_var = CResult_CommitmentSignedDecodeErrorZ_get_ok(owner_conv);
6933         uint64_t ret_ref = 0;
6934         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6935         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6936         return ret_ref;
6937 }
6938
6939 static inline struct LDKDecodeError CResult_CommitmentSignedDecodeErrorZ_get_err(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
6940         LDKDecodeError ret = *owner->contents.err;
6941         ret.is_owned = false;
6942         return ret;
6943 }
6944 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_get_err"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_err(uint64_t owner) {
6945         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
6946         LDKDecodeError ret_var = CResult_CommitmentSignedDecodeErrorZ_get_err(owner_conv);
6947         uint64_t ret_ref = 0;
6948         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6949         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6950         return ret_ref;
6951 }
6952
6953 static inline struct LDKFundingCreated CResult_FundingCreatedDecodeErrorZ_get_ok(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
6954         LDKFundingCreated ret = *owner->contents.result;
6955         ret.is_owned = false;
6956         return ret;
6957 }
6958 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_get_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_get_ok(uint64_t owner) {
6959         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
6960         LDKFundingCreated ret_var = CResult_FundingCreatedDecodeErrorZ_get_ok(owner_conv);
6961         uint64_t ret_ref = 0;
6962         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6963         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6964         return ret_ref;
6965 }
6966
6967 static inline struct LDKDecodeError CResult_FundingCreatedDecodeErrorZ_get_err(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
6968         LDKDecodeError ret = *owner->contents.err;
6969         ret.is_owned = false;
6970         return ret;
6971 }
6972 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_get_err"))) TS_CResult_FundingCreatedDecodeErrorZ_get_err(uint64_t owner) {
6973         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
6974         LDKDecodeError ret_var = CResult_FundingCreatedDecodeErrorZ_get_err(owner_conv);
6975         uint64_t ret_ref = 0;
6976         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6977         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6978         return ret_ref;
6979 }
6980
6981 static inline struct LDKFundingSigned CResult_FundingSignedDecodeErrorZ_get_ok(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
6982         LDKFundingSigned ret = *owner->contents.result;
6983         ret.is_owned = false;
6984         return ret;
6985 }
6986 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_get_ok"))) TS_CResult_FundingSignedDecodeErrorZ_get_ok(uint64_t owner) {
6987         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
6988         LDKFundingSigned ret_var = CResult_FundingSignedDecodeErrorZ_get_ok(owner_conv);
6989         uint64_t ret_ref = 0;
6990         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6991         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6992         return ret_ref;
6993 }
6994
6995 static inline struct LDKDecodeError CResult_FundingSignedDecodeErrorZ_get_err(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
6996         LDKDecodeError ret = *owner->contents.err;
6997         ret.is_owned = false;
6998         return ret;
6999 }
7000 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_get_err"))) TS_CResult_FundingSignedDecodeErrorZ_get_err(uint64_t owner) {
7001         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
7002         LDKDecodeError ret_var = CResult_FundingSignedDecodeErrorZ_get_err(owner_conv);
7003         uint64_t ret_ref = 0;
7004         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7005         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7006         return ret_ref;
7007 }
7008
7009 static inline struct LDKChannelReady CResult_ChannelReadyDecodeErrorZ_get_ok(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
7010         LDKChannelReady ret = *owner->contents.result;
7011         ret.is_owned = false;
7012         return ret;
7013 }
7014 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_get_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_get_ok(uint64_t owner) {
7015         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
7016         LDKChannelReady ret_var = CResult_ChannelReadyDecodeErrorZ_get_ok(owner_conv);
7017         uint64_t ret_ref = 0;
7018         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7019         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7020         return ret_ref;
7021 }
7022
7023 static inline struct LDKDecodeError CResult_ChannelReadyDecodeErrorZ_get_err(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
7024         LDKDecodeError ret = *owner->contents.err;
7025         ret.is_owned = false;
7026         return ret;
7027 }
7028 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_get_err"))) TS_CResult_ChannelReadyDecodeErrorZ_get_err(uint64_t owner) {
7029         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
7030         LDKDecodeError ret_var = CResult_ChannelReadyDecodeErrorZ_get_err(owner_conv);
7031         uint64_t ret_ref = 0;
7032         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7033         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7034         return ret_ref;
7035 }
7036
7037 static inline struct LDKInit CResult_InitDecodeErrorZ_get_ok(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
7038         LDKInit ret = *owner->contents.result;
7039         ret.is_owned = false;
7040         return ret;
7041 }
7042 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_get_ok"))) TS_CResult_InitDecodeErrorZ_get_ok(uint64_t owner) {
7043         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
7044         LDKInit ret_var = CResult_InitDecodeErrorZ_get_ok(owner_conv);
7045         uint64_t ret_ref = 0;
7046         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7047         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7048         return ret_ref;
7049 }
7050
7051 static inline struct LDKDecodeError CResult_InitDecodeErrorZ_get_err(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
7052         LDKDecodeError ret = *owner->contents.err;
7053         ret.is_owned = false;
7054         return ret;
7055 }
7056 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_get_err"))) TS_CResult_InitDecodeErrorZ_get_err(uint64_t owner) {
7057         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
7058         LDKDecodeError ret_var = CResult_InitDecodeErrorZ_get_err(owner_conv);
7059         uint64_t ret_ref = 0;
7060         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7061         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7062         return ret_ref;
7063 }
7064
7065 static inline struct LDKOpenChannel CResult_OpenChannelDecodeErrorZ_get_ok(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
7066         LDKOpenChannel ret = *owner->contents.result;
7067         ret.is_owned = false;
7068         return ret;
7069 }
7070 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_get_ok"))) TS_CResult_OpenChannelDecodeErrorZ_get_ok(uint64_t owner) {
7071         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
7072         LDKOpenChannel ret_var = CResult_OpenChannelDecodeErrorZ_get_ok(owner_conv);
7073         uint64_t ret_ref = 0;
7074         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7075         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7076         return ret_ref;
7077 }
7078
7079 static inline struct LDKDecodeError CResult_OpenChannelDecodeErrorZ_get_err(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
7080         LDKDecodeError ret = *owner->contents.err;
7081         ret.is_owned = false;
7082         return ret;
7083 }
7084 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_get_err"))) TS_CResult_OpenChannelDecodeErrorZ_get_err(uint64_t owner) {
7085         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
7086         LDKDecodeError ret_var = CResult_OpenChannelDecodeErrorZ_get_err(owner_conv);
7087         uint64_t ret_ref = 0;
7088         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7089         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7090         return ret_ref;
7091 }
7092
7093 static inline struct LDKRevokeAndACK CResult_RevokeAndACKDecodeErrorZ_get_ok(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
7094         LDKRevokeAndACK ret = *owner->contents.result;
7095         ret.is_owned = false;
7096         return ret;
7097 }
7098 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_get_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_ok(uint64_t owner) {
7099         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
7100         LDKRevokeAndACK ret_var = CResult_RevokeAndACKDecodeErrorZ_get_ok(owner_conv);
7101         uint64_t ret_ref = 0;
7102         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7103         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7104         return ret_ref;
7105 }
7106
7107 static inline struct LDKDecodeError CResult_RevokeAndACKDecodeErrorZ_get_err(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
7108         LDKDecodeError ret = *owner->contents.err;
7109         ret.is_owned = false;
7110         return ret;
7111 }
7112 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_get_err"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_err(uint64_t owner) {
7113         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
7114         LDKDecodeError ret_var = CResult_RevokeAndACKDecodeErrorZ_get_err(owner_conv);
7115         uint64_t ret_ref = 0;
7116         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7117         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7118         return ret_ref;
7119 }
7120
7121 static inline struct LDKShutdown CResult_ShutdownDecodeErrorZ_get_ok(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
7122         LDKShutdown ret = *owner->contents.result;
7123         ret.is_owned = false;
7124         return ret;
7125 }
7126 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_get_ok"))) TS_CResult_ShutdownDecodeErrorZ_get_ok(uint64_t owner) {
7127         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
7128         LDKShutdown ret_var = CResult_ShutdownDecodeErrorZ_get_ok(owner_conv);
7129         uint64_t ret_ref = 0;
7130         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7131         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7132         return ret_ref;
7133 }
7134
7135 static inline struct LDKDecodeError CResult_ShutdownDecodeErrorZ_get_err(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
7136         LDKDecodeError ret = *owner->contents.err;
7137         ret.is_owned = false;
7138         return ret;
7139 }
7140 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_get_err"))) TS_CResult_ShutdownDecodeErrorZ_get_err(uint64_t owner) {
7141         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
7142         LDKDecodeError ret_var = CResult_ShutdownDecodeErrorZ_get_err(owner_conv);
7143         uint64_t ret_ref = 0;
7144         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7145         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7146         return ret_ref;
7147 }
7148
7149 static inline struct LDKUpdateFailHTLC CResult_UpdateFailHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
7150         LDKUpdateFailHTLC ret = *owner->contents.result;
7151         ret.is_owned = false;
7152         return ret;
7153 }
7154 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_ok(uint64_t owner) {
7155         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
7156         LDKUpdateFailHTLC ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_ok(owner_conv);
7157         uint64_t ret_ref = 0;
7158         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7159         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7160         return ret_ref;
7161 }
7162
7163 static inline struct LDKDecodeError CResult_UpdateFailHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
7164         LDKDecodeError ret = *owner->contents.err;
7165         ret.is_owned = false;
7166         return ret;
7167 }
7168 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_err(uint64_t owner) {
7169         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
7170         LDKDecodeError ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_err(owner_conv);
7171         uint64_t ret_ref = 0;
7172         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7173         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7174         return ret_ref;
7175 }
7176
7177 static inline struct LDKUpdateFailMalformedHTLC CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
7178         LDKUpdateFailMalformedHTLC ret = *owner->contents.result;
7179         ret.is_owned = false;
7180         return ret;
7181 }
7182 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(uint64_t owner) {
7183         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
7184         LDKUpdateFailMalformedHTLC ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(owner_conv);
7185         uint64_t ret_ref = 0;
7186         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7187         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7188         return ret_ref;
7189 }
7190
7191 static inline struct LDKDecodeError CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
7192         LDKDecodeError ret = *owner->contents.err;
7193         ret.is_owned = false;
7194         return ret;
7195 }
7196 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(uint64_t owner) {
7197         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
7198         LDKDecodeError ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(owner_conv);
7199         uint64_t ret_ref = 0;
7200         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7201         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7202         return ret_ref;
7203 }
7204
7205 static inline struct LDKUpdateFee CResult_UpdateFeeDecodeErrorZ_get_ok(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
7206         LDKUpdateFee ret = *owner->contents.result;
7207         ret.is_owned = false;
7208         return ret;
7209 }
7210 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_get_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_get_ok(uint64_t owner) {
7211         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
7212         LDKUpdateFee ret_var = CResult_UpdateFeeDecodeErrorZ_get_ok(owner_conv);
7213         uint64_t ret_ref = 0;
7214         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7215         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7216         return ret_ref;
7217 }
7218
7219 static inline struct LDKDecodeError CResult_UpdateFeeDecodeErrorZ_get_err(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
7220         LDKDecodeError ret = *owner->contents.err;
7221         ret.is_owned = false;
7222         return ret;
7223 }
7224 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_get_err"))) TS_CResult_UpdateFeeDecodeErrorZ_get_err(uint64_t owner) {
7225         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
7226         LDKDecodeError ret_var = CResult_UpdateFeeDecodeErrorZ_get_err(owner_conv);
7227         uint64_t ret_ref = 0;
7228         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7229         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7230         return ret_ref;
7231 }
7232
7233 static inline struct LDKUpdateFulfillHTLC CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
7234         LDKUpdateFulfillHTLC ret = *owner->contents.result;
7235         ret.is_owned = false;
7236         return ret;
7237 }
7238 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(uint64_t owner) {
7239         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
7240         LDKUpdateFulfillHTLC ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(owner_conv);
7241         uint64_t ret_ref = 0;
7242         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7243         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7244         return ret_ref;
7245 }
7246
7247 static inline struct LDKDecodeError CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
7248         LDKDecodeError ret = *owner->contents.err;
7249         ret.is_owned = false;
7250         return ret;
7251 }
7252 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(uint64_t owner) {
7253         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
7254         LDKDecodeError ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(owner_conv);
7255         uint64_t ret_ref = 0;
7256         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7257         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7258         return ret_ref;
7259 }
7260
7261 static inline struct LDKUpdateAddHTLC CResult_UpdateAddHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
7262         LDKUpdateAddHTLC ret = *owner->contents.result;
7263         ret.is_owned = false;
7264         return ret;
7265 }
7266 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_ok(uint64_t owner) {
7267         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
7268         LDKUpdateAddHTLC ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_ok(owner_conv);
7269         uint64_t ret_ref = 0;
7270         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7271         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7272         return ret_ref;
7273 }
7274
7275 static inline struct LDKDecodeError CResult_UpdateAddHTLCDecodeErrorZ_get_err(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
7276         LDKDecodeError ret = *owner->contents.err;
7277         ret.is_owned = false;
7278         return ret;
7279 }
7280 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_err(uint64_t owner) {
7281         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
7282         LDKDecodeError ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_err(owner_conv);
7283         uint64_t ret_ref = 0;
7284         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7285         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7286         return ret_ref;
7287 }
7288
7289 static inline struct LDKOnionMessage CResult_OnionMessageDecodeErrorZ_get_ok(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
7290         LDKOnionMessage ret = *owner->contents.result;
7291         ret.is_owned = false;
7292         return ret;
7293 }
7294 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_get_ok"))) TS_CResult_OnionMessageDecodeErrorZ_get_ok(uint64_t owner) {
7295         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
7296         LDKOnionMessage ret_var = CResult_OnionMessageDecodeErrorZ_get_ok(owner_conv);
7297         uint64_t ret_ref = 0;
7298         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7299         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7300         return ret_ref;
7301 }
7302
7303 static inline struct LDKDecodeError CResult_OnionMessageDecodeErrorZ_get_err(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
7304         LDKDecodeError ret = *owner->contents.err;
7305         ret.is_owned = false;
7306         return ret;
7307 }
7308 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_get_err"))) TS_CResult_OnionMessageDecodeErrorZ_get_err(uint64_t owner) {
7309         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
7310         LDKDecodeError ret_var = CResult_OnionMessageDecodeErrorZ_get_err(owner_conv);
7311         uint64_t ret_ref = 0;
7312         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7313         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7314         return ret_ref;
7315 }
7316
7317 static inline struct LDKPing CResult_PingDecodeErrorZ_get_ok(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
7318         LDKPing ret = *owner->contents.result;
7319         ret.is_owned = false;
7320         return ret;
7321 }
7322 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_get_ok"))) TS_CResult_PingDecodeErrorZ_get_ok(uint64_t owner) {
7323         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
7324         LDKPing ret_var = CResult_PingDecodeErrorZ_get_ok(owner_conv);
7325         uint64_t ret_ref = 0;
7326         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7327         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7328         return ret_ref;
7329 }
7330
7331 static inline struct LDKDecodeError CResult_PingDecodeErrorZ_get_err(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
7332         LDKDecodeError ret = *owner->contents.err;
7333         ret.is_owned = false;
7334         return ret;
7335 }
7336 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_get_err"))) TS_CResult_PingDecodeErrorZ_get_err(uint64_t owner) {
7337         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
7338         LDKDecodeError ret_var = CResult_PingDecodeErrorZ_get_err(owner_conv);
7339         uint64_t ret_ref = 0;
7340         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7341         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7342         return ret_ref;
7343 }
7344
7345 static inline struct LDKPong CResult_PongDecodeErrorZ_get_ok(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
7346         LDKPong ret = *owner->contents.result;
7347         ret.is_owned = false;
7348         return ret;
7349 }
7350 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_get_ok"))) TS_CResult_PongDecodeErrorZ_get_ok(uint64_t owner) {
7351         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
7352         LDKPong ret_var = CResult_PongDecodeErrorZ_get_ok(owner_conv);
7353         uint64_t ret_ref = 0;
7354         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7355         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7356         return ret_ref;
7357 }
7358
7359 static inline struct LDKDecodeError CResult_PongDecodeErrorZ_get_err(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
7360         LDKDecodeError ret = *owner->contents.err;
7361         ret.is_owned = false;
7362         return ret;
7363 }
7364 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_get_err"))) TS_CResult_PongDecodeErrorZ_get_err(uint64_t owner) {
7365         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
7366         LDKDecodeError ret_var = CResult_PongDecodeErrorZ_get_err(owner_conv);
7367         uint64_t ret_ref = 0;
7368         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7369         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7370         return ret_ref;
7371 }
7372
7373 static inline struct LDKUnsignedChannelAnnouncement CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7374         LDKUnsignedChannelAnnouncement ret = *owner->contents.result;
7375         ret.is_owned = false;
7376         return ret;
7377 }
7378 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
7379         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
7380         LDKUnsignedChannelAnnouncement ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
7381         uint64_t ret_ref = 0;
7382         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7383         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7384         return ret_ref;
7385 }
7386
7387 static inline struct LDKDecodeError CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7388         LDKDecodeError ret = *owner->contents.err;
7389         ret.is_owned = false;
7390         return ret;
7391 }
7392 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
7393         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
7394         LDKDecodeError ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
7395         uint64_t ret_ref = 0;
7396         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7397         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7398         return ret_ref;
7399 }
7400
7401 static inline struct LDKChannelAnnouncement CResult_ChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7402         LDKChannelAnnouncement ret = *owner->contents.result;
7403         ret.is_owned = false;
7404         return ret;
7405 }
7406 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
7407         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
7408         LDKChannelAnnouncement ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
7409         uint64_t ret_ref = 0;
7410         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7411         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7412         return ret_ref;
7413 }
7414
7415 static inline struct LDKDecodeError CResult_ChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7416         LDKDecodeError ret = *owner->contents.err;
7417         ret.is_owned = false;
7418         return ret;
7419 }
7420 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_get_err"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
7421         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
7422         LDKDecodeError ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
7423         uint64_t ret_ref = 0;
7424         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7425         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7426         return ret_ref;
7427 }
7428
7429 static inline struct LDKUnsignedChannelUpdate CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
7430         LDKUnsignedChannelUpdate ret = *owner->contents.result;
7431         ret.is_owned = false;
7432         return ret;
7433 }
7434 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(uint64_t owner) {
7435         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
7436         LDKUnsignedChannelUpdate ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(owner_conv);
7437         uint64_t ret_ref = 0;
7438         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7439         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7440         return ret_ref;
7441 }
7442
7443 static inline struct LDKDecodeError CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
7444         LDKDecodeError ret = *owner->contents.err;
7445         ret.is_owned = false;
7446         return ret;
7447 }
7448 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(uint64_t owner) {
7449         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
7450         LDKDecodeError ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(owner_conv);
7451         uint64_t ret_ref = 0;
7452         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7453         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7454         return ret_ref;
7455 }
7456
7457 static inline struct LDKChannelUpdate CResult_ChannelUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
7458         LDKChannelUpdate ret = *owner->contents.result;
7459         ret.is_owned = false;
7460         return ret;
7461 }
7462 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_get_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_ok(uint64_t owner) {
7463         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
7464         LDKChannelUpdate ret_var = CResult_ChannelUpdateDecodeErrorZ_get_ok(owner_conv);
7465         uint64_t ret_ref = 0;
7466         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7467         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7468         return ret_ref;
7469 }
7470
7471 static inline struct LDKDecodeError CResult_ChannelUpdateDecodeErrorZ_get_err(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
7472         LDKDecodeError ret = *owner->contents.err;
7473         ret.is_owned = false;
7474         return ret;
7475 }
7476 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_get_err"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_err(uint64_t owner) {
7477         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
7478         LDKDecodeError ret_var = CResult_ChannelUpdateDecodeErrorZ_get_err(owner_conv);
7479         uint64_t ret_ref = 0;
7480         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7481         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7482         return ret_ref;
7483 }
7484
7485 static inline struct LDKErrorMessage CResult_ErrorMessageDecodeErrorZ_get_ok(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
7486         LDKErrorMessage ret = *owner->contents.result;
7487         ret.is_owned = false;
7488         return ret;
7489 }
7490 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_get_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_get_ok(uint64_t owner) {
7491         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
7492         LDKErrorMessage ret_var = CResult_ErrorMessageDecodeErrorZ_get_ok(owner_conv);
7493         uint64_t ret_ref = 0;
7494         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7495         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7496         return ret_ref;
7497 }
7498
7499 static inline struct LDKDecodeError CResult_ErrorMessageDecodeErrorZ_get_err(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
7500         LDKDecodeError ret = *owner->contents.err;
7501         ret.is_owned = false;
7502         return ret;
7503 }
7504 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_get_err"))) TS_CResult_ErrorMessageDecodeErrorZ_get_err(uint64_t owner) {
7505         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
7506         LDKDecodeError ret_var = CResult_ErrorMessageDecodeErrorZ_get_err(owner_conv);
7507         uint64_t ret_ref = 0;
7508         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7509         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7510         return ret_ref;
7511 }
7512
7513 static inline struct LDKWarningMessage CResult_WarningMessageDecodeErrorZ_get_ok(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
7514         LDKWarningMessage ret = *owner->contents.result;
7515         ret.is_owned = false;
7516         return ret;
7517 }
7518 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_get_ok"))) TS_CResult_WarningMessageDecodeErrorZ_get_ok(uint64_t owner) {
7519         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
7520         LDKWarningMessage ret_var = CResult_WarningMessageDecodeErrorZ_get_ok(owner_conv);
7521         uint64_t ret_ref = 0;
7522         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7523         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7524         return ret_ref;
7525 }
7526
7527 static inline struct LDKDecodeError CResult_WarningMessageDecodeErrorZ_get_err(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
7528         LDKDecodeError ret = *owner->contents.err;
7529         ret.is_owned = false;
7530         return ret;
7531 }
7532 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_get_err"))) TS_CResult_WarningMessageDecodeErrorZ_get_err(uint64_t owner) {
7533         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
7534         LDKDecodeError ret_var = CResult_WarningMessageDecodeErrorZ_get_err(owner_conv);
7535         uint64_t ret_ref = 0;
7536         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7537         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7538         return ret_ref;
7539 }
7540
7541 static inline struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7542         LDKUnsignedNodeAnnouncement ret = *owner->contents.result;
7543         ret.is_owned = false;
7544         return ret;
7545 }
7546 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
7547         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
7548         LDKUnsignedNodeAnnouncement ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
7549         uint64_t ret_ref = 0;
7550         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7551         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7552         return ret_ref;
7553 }
7554
7555 static inline struct LDKDecodeError CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7556         LDKDecodeError ret = *owner->contents.err;
7557         ret.is_owned = false;
7558         return ret;
7559 }
7560 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
7561         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
7562         LDKDecodeError ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(owner_conv);
7563         uint64_t ret_ref = 0;
7564         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7565         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7566         return ret_ref;
7567 }
7568
7569 static inline struct LDKNodeAnnouncement CResult_NodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7570         LDKNodeAnnouncement ret = *owner->contents.result;
7571         ret.is_owned = false;
7572         return ret;
7573 }
7574 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
7575         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
7576         LDKNodeAnnouncement ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
7577         uint64_t ret_ref = 0;
7578         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7579         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7580         return ret_ref;
7581 }
7582
7583 static inline struct LDKDecodeError CResult_NodeAnnouncementDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7584         LDKDecodeError ret = *owner->contents.err;
7585         ret.is_owned = false;
7586         return ret;
7587 }
7588 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_get_err"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
7589         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
7590         LDKDecodeError ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_err(owner_conv);
7591         uint64_t ret_ref = 0;
7592         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7593         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7594         return ret_ref;
7595 }
7596
7597 static inline struct LDKQueryShortChannelIds CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
7598         LDKQueryShortChannelIds ret = *owner->contents.result;
7599         ret.is_owned = false;
7600         return ret;
7601 }
7602 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(uint64_t owner) {
7603         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
7604         LDKQueryShortChannelIds ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(owner_conv);
7605         uint64_t ret_ref = 0;
7606         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7607         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7608         return ret_ref;
7609 }
7610
7611 static inline struct LDKDecodeError CResult_QueryShortChannelIdsDecodeErrorZ_get_err(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
7612         LDKDecodeError ret = *owner->contents.err;
7613         ret.is_owned = false;
7614         return ret;
7615 }
7616 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_err"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_err(uint64_t owner) {
7617         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
7618         LDKDecodeError ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_err(owner_conv);
7619         uint64_t ret_ref = 0;
7620         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7621         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7622         return ret_ref;
7623 }
7624
7625 static inline struct LDKReplyShortChannelIdsEnd CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
7626         LDKReplyShortChannelIdsEnd ret = *owner->contents.result;
7627         ret.is_owned = false;
7628         return ret;
7629 }
7630 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(uint64_t owner) {
7631         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
7632         LDKReplyShortChannelIdsEnd ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(owner_conv);
7633         uint64_t ret_ref = 0;
7634         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7635         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7636         return ret_ref;
7637 }
7638
7639 static inline struct LDKDecodeError CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
7640         LDKDecodeError ret = *owner->contents.err;
7641         ret.is_owned = false;
7642         return ret;
7643 }
7644 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(uint64_t owner) {
7645         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
7646         LDKDecodeError ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(owner_conv);
7647         uint64_t ret_ref = 0;
7648         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7649         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7650         return ret_ref;
7651 }
7652
7653 static inline struct LDKQueryChannelRange CResult_QueryChannelRangeDecodeErrorZ_get_ok(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
7654         LDKQueryChannelRange ret = *owner->contents.result;
7655         ret.is_owned = false;
7656         return ret;
7657 }
7658 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_get_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_ok(uint64_t owner) {
7659         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
7660         LDKQueryChannelRange ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_ok(owner_conv);
7661         uint64_t ret_ref = 0;
7662         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7663         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7664         return ret_ref;
7665 }
7666
7667 static inline struct LDKDecodeError CResult_QueryChannelRangeDecodeErrorZ_get_err(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
7668         LDKDecodeError ret = *owner->contents.err;
7669         ret.is_owned = false;
7670         return ret;
7671 }
7672 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_get_err"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_err(uint64_t owner) {
7673         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
7674         LDKDecodeError ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_err(owner_conv);
7675         uint64_t ret_ref = 0;
7676         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7677         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7678         return ret_ref;
7679 }
7680
7681 static inline struct LDKReplyChannelRange CResult_ReplyChannelRangeDecodeErrorZ_get_ok(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
7682         LDKReplyChannelRange ret = *owner->contents.result;
7683         ret.is_owned = false;
7684         return ret;
7685 }
7686 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_get_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_ok(uint64_t owner) {
7687         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
7688         LDKReplyChannelRange ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_ok(owner_conv);
7689         uint64_t ret_ref = 0;
7690         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7691         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7692         return ret_ref;
7693 }
7694
7695 static inline struct LDKDecodeError CResult_ReplyChannelRangeDecodeErrorZ_get_err(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
7696         LDKDecodeError ret = *owner->contents.err;
7697         ret.is_owned = false;
7698         return ret;
7699 }
7700 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_get_err"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_err(uint64_t owner) {
7701         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
7702         LDKDecodeError ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_err(owner_conv);
7703         uint64_t ret_ref = 0;
7704         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7705         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7706         return ret_ref;
7707 }
7708
7709 static inline struct LDKGossipTimestampFilter CResult_GossipTimestampFilterDecodeErrorZ_get_ok(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
7710         LDKGossipTimestampFilter ret = *owner->contents.result;
7711         ret.is_owned = false;
7712         return ret;
7713 }
7714 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_get_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_ok(uint64_t owner) {
7715         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
7716         LDKGossipTimestampFilter ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_ok(owner_conv);
7717         uint64_t ret_ref = 0;
7718         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7719         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7720         return ret_ref;
7721 }
7722
7723 static inline struct LDKDecodeError CResult_GossipTimestampFilterDecodeErrorZ_get_err(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
7724         LDKDecodeError ret = *owner->contents.err;
7725         ret.is_owned = false;
7726         return ret;
7727 }
7728 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_get_err"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_err(uint64_t owner) {
7729         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
7730         LDKDecodeError ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_err(owner_conv);
7731         uint64_t ret_ref = 0;
7732         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7733         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7734         return ret_ref;
7735 }
7736
7737 uint32_t __attribute__((export_name("TS_LDKSignOrCreationError_ty_from_ptr"))) TS_LDKSignOrCreationError_ty_from_ptr(uint64_t ptr) {
7738         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
7739         switch(obj->tag) {
7740                 case LDKSignOrCreationError_SignError: return 0;
7741                 case LDKSignOrCreationError_CreationError: return 1;
7742                 default: abort();
7743         }
7744 }
7745 uint32_t __attribute__((export_name("TS_LDKSignOrCreationError_CreationError_get_creation_error"))) TS_LDKSignOrCreationError_CreationError_get_creation_error(uint64_t ptr) {
7746         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
7747         assert(obj->tag == LDKSignOrCreationError_CreationError);
7748                         uint32_t creation_error_conv = LDKCreationError_to_js(obj->creation_error);
7749         return creation_error_conv;
7750 }
7751 static inline struct LDKInvoice CResult_InvoiceSignOrCreationErrorZ_get_ok(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
7752         LDKInvoice ret = *owner->contents.result;
7753         ret.is_owned = false;
7754         return ret;
7755 }
7756 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_get_ok"))) TS_CResult_InvoiceSignOrCreationErrorZ_get_ok(uint64_t owner) {
7757         LDKCResult_InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
7758         LDKInvoice ret_var = CResult_InvoiceSignOrCreationErrorZ_get_ok(owner_conv);
7759         uint64_t ret_ref = 0;
7760         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7761         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7762         return ret_ref;
7763 }
7764
7765 static inline struct LDKSignOrCreationError CResult_InvoiceSignOrCreationErrorZ_get_err(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
7766 CHECK(!owner->result_ok);
7767         return SignOrCreationError_clone(&*owner->contents.err);
7768 }
7769 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_get_err"))) TS_CResult_InvoiceSignOrCreationErrorZ_get_err(uint64_t owner) {
7770         LDKCResult_InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
7771         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
7772         *ret_copy = CResult_InvoiceSignOrCreationErrorZ_get_err(owner_conv);
7773         uint64_t ret_ref = tag_ptr(ret_copy, true);
7774         return ret_ref;
7775 }
7776
7777 typedef struct LDKFilter_JCalls {
7778         atomic_size_t refcnt;
7779         uint32_t instance_ptr;
7780 } LDKFilter_JCalls;
7781 static void LDKFilter_JCalls_free(void* this_arg) {
7782         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
7783         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7784                 FREE(j_calls);
7785         }
7786 }
7787 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
7788         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
7789         int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
7790         memcpy(txid_arr->elems, *txid, 32);
7791         LDKu8slice script_pubkey_var = script_pubkey;
7792         int8_tArray script_pubkey_arr = init_int8_tArray(script_pubkey_var.datalen, __LINE__);
7793         memcpy(script_pubkey_arr->elems, script_pubkey_var.data, script_pubkey_var.datalen);
7794         js_invoke_function_uuuuuu(j_calls->instance_ptr, 33, (uint32_t)txid_arr, (uint32_t)script_pubkey_arr, 0, 0, 0, 0);
7795 }
7796 void register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
7797         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
7798         LDKWatchedOutput output_var = output;
7799         uint64_t output_ref = 0;
7800         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
7801         output_ref = tag_ptr(output_var.inner, output_var.is_owned);
7802         js_invoke_function_buuuuu(j_calls->instance_ptr, 34, output_ref, 0, 0, 0, 0, 0);
7803 }
7804 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
7805         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
7806         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7807 }
7808 static inline LDKFilter LDKFilter_init (JSValue o) {
7809         LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
7810         atomic_init(&calls->refcnt, 1);
7811         calls->instance_ptr = o;
7812
7813         LDKFilter ret = {
7814                 .this_arg = (void*) calls,
7815                 .register_tx = register_tx_LDKFilter_jcall,
7816                 .register_output = register_output_LDKFilter_jcall,
7817                 .free = LDKFilter_JCalls_free,
7818         };
7819         return ret;
7820 }
7821 uint64_t  __attribute__((export_name("TS_LDKFilter_new"))) TS_LDKFilter_new(JSValue o) {
7822         LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
7823         *res_ptr = LDKFilter_init(o);
7824         return tag_ptr(res_ptr, true);
7825 }
7826 void  __attribute__((export_name("TS_Filter_register_tx"))) TS_Filter_register_tx(uint64_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
7827         void* this_arg_ptr = untag_ptr(this_arg);
7828         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7829         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
7830         unsigned char txid_arr[32];
7831         CHECK(txid->arr_len == 32);
7832         memcpy(txid_arr, txid->elems, 32); FREE(txid);
7833         unsigned char (*txid_ref)[32] = &txid_arr;
7834         LDKu8slice script_pubkey_ref;
7835         script_pubkey_ref.datalen = script_pubkey->arr_len;
7836         script_pubkey_ref.data = script_pubkey->elems;
7837         (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
7838         FREE(script_pubkey);
7839 }
7840
7841 void  __attribute__((export_name("TS_Filter_register_output"))) TS_Filter_register_output(uint64_t this_arg, uint64_t output) {
7842         void* this_arg_ptr = untag_ptr(this_arg);
7843         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7844         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
7845         LDKWatchedOutput output_conv;
7846         output_conv.inner = untag_ptr(output);
7847         output_conv.is_owned = ptr_is_owned(output);
7848         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
7849         output_conv = WatchedOutput_clone(&output_conv);
7850         (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
7851 }
7852
7853 uint32_t __attribute__((export_name("TS_LDKCOption_FilterZ_ty_from_ptr"))) TS_LDKCOption_FilterZ_ty_from_ptr(uint64_t ptr) {
7854         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
7855         switch(obj->tag) {
7856                 case LDKCOption_FilterZ_Some: return 0;
7857                 case LDKCOption_FilterZ_None: return 1;
7858                 default: abort();
7859         }
7860 }
7861 uint64_t __attribute__((export_name("TS_LDKCOption_FilterZ_Some_get_some"))) TS_LDKCOption_FilterZ_Some_get_some(uint64_t ptr) {
7862         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
7863         assert(obj->tag == LDKCOption_FilterZ_Some);
7864                         LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
7865                         *some_ret = obj->some;
7866                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
7867                         if ((*some_ret).free == LDKFilter_JCalls_free) {
7868                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7869                                 LDKFilter_JCalls_cloned(&(*some_ret));
7870                         }
7871         return tag_ptr(some_ret, true);
7872 }
7873 static inline struct LDKLockedChannelMonitor CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
7874         LDKLockedChannelMonitor ret = *owner->contents.result;
7875         ret.is_owned = false;
7876         return ret;
7877 }
7878 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_get_ok"))) TS_CResult_LockedChannelMonitorNoneZ_get_ok(uint64_t owner) {
7879         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
7880         LDKLockedChannelMonitor ret_var = CResult_LockedChannelMonitorNoneZ_get_ok(owner_conv);
7881         uint64_t ret_ref = 0;
7882         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7883         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7884         return ret_ref;
7885 }
7886
7887 static inline void CResult_LockedChannelMonitorNoneZ_get_err(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
7888 CHECK(!owner->result_ok);
7889         return *owner->contents.err;
7890 }
7891 void  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_get_err"))) TS_CResult_LockedChannelMonitorNoneZ_get_err(uint64_t owner) {
7892         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
7893         CResult_LockedChannelMonitorNoneZ_get_err(owner_conv);
7894 }
7895
7896 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
7897         LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
7898         for (size_t i = 0; i < ret.datalen; i++) {
7899                 ret.data[i] = OutPoint_clone(&orig->data[i]);
7900         }
7901         return ret;
7902 }
7903 typedef struct LDKMessageSendEventsProvider_JCalls {
7904         atomic_size_t refcnt;
7905         uint32_t instance_ptr;
7906 } LDKMessageSendEventsProvider_JCalls;
7907 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
7908         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
7909         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7910                 FREE(j_calls);
7911         }
7912 }
7913 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
7914         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
7915         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 35, 0, 0, 0, 0, 0, 0);
7916         LDKCVec_MessageSendEventZ ret_constr;
7917         ret_constr.datalen = ret->arr_len;
7918         if (ret_constr.datalen > 0)
7919                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
7920         else
7921                 ret_constr.data = NULL;
7922         uint64_t* ret_vals = ret->elems;
7923         for (size_t s = 0; s < ret_constr.datalen; s++) {
7924                 uint64_t ret_conv_18 = ret_vals[s];
7925                 void* ret_conv_18_ptr = untag_ptr(ret_conv_18);
7926                 CHECK_ACCESS(ret_conv_18_ptr);
7927                 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
7928                 FREE(untag_ptr(ret_conv_18));
7929                 ret_constr.data[s] = ret_conv_18_conv;
7930         }
7931         FREE(ret);
7932         return ret_constr;
7933 }
7934 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
7935         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
7936         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7937 }
7938 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JSValue o) {
7939         LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
7940         atomic_init(&calls->refcnt, 1);
7941         calls->instance_ptr = o;
7942
7943         LDKMessageSendEventsProvider ret = {
7944                 .this_arg = (void*) calls,
7945                 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
7946                 .free = LDKMessageSendEventsProvider_JCalls_free,
7947         };
7948         return ret;
7949 }
7950 uint64_t  __attribute__((export_name("TS_LDKMessageSendEventsProvider_new"))) TS_LDKMessageSendEventsProvider_new(JSValue o) {
7951         LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
7952         *res_ptr = LDKMessageSendEventsProvider_init(o);
7953         return tag_ptr(res_ptr, true);
7954 }
7955 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) {
7956         void* this_arg_ptr = untag_ptr(this_arg);
7957         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7958         LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
7959         LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
7960         uint64_tArray ret_arr = NULL;
7961         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
7962         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
7963         for (size_t s = 0; s < ret_var.datalen; s++) {
7964                 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
7965                 *ret_conv_18_copy = ret_var.data[s];
7966                 uint64_t ret_conv_18_ref = tag_ptr(ret_conv_18_copy, true);
7967                 ret_arr_ptr[s] = ret_conv_18_ref;
7968         }
7969         
7970         FREE(ret_var.data);
7971         return ret_arr;
7972 }
7973
7974 typedef struct LDKOnionMessageProvider_JCalls {
7975         atomic_size_t refcnt;
7976         uint32_t instance_ptr;
7977 } LDKOnionMessageProvider_JCalls;
7978 static void LDKOnionMessageProvider_JCalls_free(void* this_arg) {
7979         LDKOnionMessageProvider_JCalls *j_calls = (LDKOnionMessageProvider_JCalls*) this_arg;
7980         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7981                 FREE(j_calls);
7982         }
7983 }
7984 LDKOnionMessage next_onion_message_for_peer_LDKOnionMessageProvider_jcall(const void* this_arg, LDKPublicKey peer_node_id) {
7985         LDKOnionMessageProvider_JCalls *j_calls = (LDKOnionMessageProvider_JCalls*) this_arg;
7986         int8_tArray peer_node_id_arr = init_int8_tArray(33, __LINE__);
7987         memcpy(peer_node_id_arr->elems, peer_node_id.compressed_form, 33);
7988         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 36, (uint32_t)peer_node_id_arr, 0, 0, 0, 0, 0);
7989         LDKOnionMessage ret_conv;
7990         ret_conv.inner = untag_ptr(ret);
7991         ret_conv.is_owned = ptr_is_owned(ret);
7992         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
7993         return ret_conv;
7994 }
7995 static void LDKOnionMessageProvider_JCalls_cloned(LDKOnionMessageProvider* new_obj) {
7996         LDKOnionMessageProvider_JCalls *j_calls = (LDKOnionMessageProvider_JCalls*) new_obj->this_arg;
7997         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7998 }
7999 static inline LDKOnionMessageProvider LDKOnionMessageProvider_init (JSValue o) {
8000         LDKOnionMessageProvider_JCalls *calls = MALLOC(sizeof(LDKOnionMessageProvider_JCalls), "LDKOnionMessageProvider_JCalls");
8001         atomic_init(&calls->refcnt, 1);
8002         calls->instance_ptr = o;
8003
8004         LDKOnionMessageProvider ret = {
8005                 .this_arg = (void*) calls,
8006                 .next_onion_message_for_peer = next_onion_message_for_peer_LDKOnionMessageProvider_jcall,
8007                 .free = LDKOnionMessageProvider_JCalls_free,
8008         };
8009         return ret;
8010 }
8011 uint64_t  __attribute__((export_name("TS_LDKOnionMessageProvider_new"))) TS_LDKOnionMessageProvider_new(JSValue o) {
8012         LDKOnionMessageProvider *res_ptr = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
8013         *res_ptr = LDKOnionMessageProvider_init(o);
8014         return tag_ptr(res_ptr, true);
8015 }
8016 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) {
8017         void* this_arg_ptr = untag_ptr(this_arg);
8018         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8019         LDKOnionMessageProvider* this_arg_conv = (LDKOnionMessageProvider*)this_arg_ptr;
8020         LDKPublicKey peer_node_id_ref;
8021         CHECK(peer_node_id->arr_len == 33);
8022         memcpy(peer_node_id_ref.compressed_form, peer_node_id->elems, 33); FREE(peer_node_id);
8023         LDKOnionMessage ret_var = (this_arg_conv->next_onion_message_for_peer)(this_arg_conv->this_arg, peer_node_id_ref);
8024         uint64_t ret_ref = 0;
8025         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8026         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8027         return ret_ref;
8028 }
8029
8030 typedef struct LDKEventHandler_JCalls {
8031         atomic_size_t refcnt;
8032         uint32_t instance_ptr;
8033 } LDKEventHandler_JCalls;
8034 static void LDKEventHandler_JCalls_free(void* this_arg) {
8035         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
8036         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8037                 FREE(j_calls);
8038         }
8039 }
8040 void handle_event_LDKEventHandler_jcall(const void* this_arg, const LDKEvent * event) {
8041         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
8042         LDKEvent *ret_event = MALLOC(sizeof(LDKEvent), "LDKEvent ret conversion");
8043         *ret_event = Event_clone(event);
8044         uint64_t ref_event = tag_ptr(ret_event, true);
8045         js_invoke_function_buuuuu(j_calls->instance_ptr, 37, ref_event, 0, 0, 0, 0, 0);
8046 }
8047 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
8048         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
8049         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8050 }
8051 static inline LDKEventHandler LDKEventHandler_init (JSValue o) {
8052         LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
8053         atomic_init(&calls->refcnt, 1);
8054         calls->instance_ptr = o;
8055
8056         LDKEventHandler ret = {
8057                 .this_arg = (void*) calls,
8058                 .handle_event = handle_event_LDKEventHandler_jcall,
8059                 .free = LDKEventHandler_JCalls_free,
8060         };
8061         return ret;
8062 }
8063 uint64_t  __attribute__((export_name("TS_LDKEventHandler_new"))) TS_LDKEventHandler_new(JSValue o) {
8064         LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
8065         *res_ptr = LDKEventHandler_init(o);
8066         return tag_ptr(res_ptr, true);
8067 }
8068 void  __attribute__((export_name("TS_EventHandler_handle_event"))) TS_EventHandler_handle_event(uint64_t this_arg, uint64_t event) {
8069         void* this_arg_ptr = untag_ptr(this_arg);
8070         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8071         LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
8072         LDKEvent* event_conv = (LDKEvent*)untag_ptr(event);
8073         (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
8074 }
8075
8076 typedef struct LDKEventsProvider_JCalls {
8077         atomic_size_t refcnt;
8078         uint32_t instance_ptr;
8079 } LDKEventsProvider_JCalls;
8080 static void LDKEventsProvider_JCalls_free(void* this_arg) {
8081         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
8082         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8083                 FREE(j_calls);
8084         }
8085 }
8086 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
8087         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
8088         LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
8089         *handler_ret = handler;
8090         js_invoke_function_buuuuu(j_calls->instance_ptr, 38, tag_ptr(handler_ret, true), 0, 0, 0, 0, 0);
8091 }
8092 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
8093         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
8094         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8095 }
8096 static inline LDKEventsProvider LDKEventsProvider_init (JSValue o) {
8097         LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
8098         atomic_init(&calls->refcnt, 1);
8099         calls->instance_ptr = o;
8100
8101         LDKEventsProvider ret = {
8102                 .this_arg = (void*) calls,
8103                 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
8104                 .free = LDKEventsProvider_JCalls_free,
8105         };
8106         return ret;
8107 }
8108 uint64_t  __attribute__((export_name("TS_LDKEventsProvider_new"))) TS_LDKEventsProvider_new(JSValue o) {
8109         LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
8110         *res_ptr = LDKEventsProvider_init(o);
8111         return tag_ptr(res_ptr, true);
8112 }
8113 void  __attribute__((export_name("TS_EventsProvider_process_pending_events"))) TS_EventsProvider_process_pending_events(uint64_t this_arg, uint64_t handler) {
8114         void* this_arg_ptr = untag_ptr(this_arg);
8115         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8116         LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
8117         void* handler_ptr = untag_ptr(handler);
8118         CHECK_ACCESS(handler_ptr);
8119         LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
8120         if (handler_conv.free == LDKEventHandler_JCalls_free) {
8121                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8122                 LDKEventHandler_JCalls_cloned(&handler_conv);
8123         }
8124         (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
8125 }
8126
8127 typedef struct LDKScore_JCalls {
8128         atomic_size_t refcnt;
8129         uint32_t instance_ptr;
8130 } LDKScore_JCalls;
8131 static void LDKScore_JCalls_free(void* this_arg) {
8132         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8133         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8134                 FREE(j_calls);
8135         }
8136 }
8137 uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t short_channel_id, const LDKNodeId * source, const LDKNodeId * target, LDKChannelUsage usage) {
8138         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8139         int64_t short_channel_id_conv = short_channel_id;
8140         LDKNodeId source_var = *source;
8141         uint64_t source_ref = 0;
8142         source_var = NodeId_clone(&source_var);
8143         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_var);
8144         source_ref = tag_ptr(source_var.inner, source_var.is_owned);
8145         LDKNodeId target_var = *target;
8146         uint64_t target_ref = 0;
8147         target_var = NodeId_clone(&target_var);
8148         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_var);
8149         target_ref = tag_ptr(target_var.inner, target_var.is_owned);
8150         LDKChannelUsage usage_var = usage;
8151         uint64_t usage_ref = 0;
8152         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_var);
8153         usage_ref = tag_ptr(usage_var.inner, usage_var.is_owned);
8154         return js_invoke_function_bbbbuu(j_calls->instance_ptr, 39, short_channel_id_conv, source_ref, target_ref, usage_ref, 0, 0);
8155 }
8156 void payment_path_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
8157         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8158         LDKCVec_RouteHopZ path_var = path;
8159         uint64_tArray path_arr = NULL;
8160         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
8161         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
8162         for (size_t k = 0; k < path_var.datalen; k++) {
8163                 LDKRouteHop path_conv_10_var = path_var.data[k];
8164                 uint64_t path_conv_10_ref = 0;
8165                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
8166                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
8167                 path_arr_ptr[k] = path_conv_10_ref;
8168         }
8169         
8170         FREE(path_var.data);
8171         int64_t short_channel_id_conv = short_channel_id;
8172         js_invoke_function_ubuuuu(j_calls->instance_ptr, 40, (uint32_t)path_arr, short_channel_id_conv, 0, 0, 0, 0);
8173 }
8174 void payment_path_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) {
8175         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8176         LDKCVec_RouteHopZ path_var = path;
8177         uint64_tArray path_arr = NULL;
8178         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
8179         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
8180         for (size_t k = 0; k < path_var.datalen; k++) {
8181                 LDKRouteHop path_conv_10_var = path_var.data[k];
8182                 uint64_t path_conv_10_ref = 0;
8183                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
8184                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
8185                 path_arr_ptr[k] = path_conv_10_ref;
8186         }
8187         
8188         FREE(path_var.data);
8189         js_invoke_function_uuuuuu(j_calls->instance_ptr, 41, (uint32_t)path_arr, 0, 0, 0, 0, 0);
8190 }
8191 void probe_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
8192         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8193         LDKCVec_RouteHopZ path_var = path;
8194         uint64_tArray path_arr = NULL;
8195         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
8196         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
8197         for (size_t k = 0; k < path_var.datalen; k++) {
8198                 LDKRouteHop path_conv_10_var = path_var.data[k];
8199                 uint64_t path_conv_10_ref = 0;
8200                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
8201                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
8202                 path_arr_ptr[k] = path_conv_10_ref;
8203         }
8204         
8205         FREE(path_var.data);
8206         int64_t short_channel_id_conv = short_channel_id;
8207         js_invoke_function_ubuuuu(j_calls->instance_ptr, 42, (uint32_t)path_arr, short_channel_id_conv, 0, 0, 0, 0);
8208 }
8209 void probe_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) {
8210         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8211         LDKCVec_RouteHopZ path_var = path;
8212         uint64_tArray path_arr = NULL;
8213         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
8214         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
8215         for (size_t k = 0; k < path_var.datalen; k++) {
8216                 LDKRouteHop path_conv_10_var = path_var.data[k];
8217                 uint64_t path_conv_10_ref = 0;
8218                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
8219                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
8220                 path_arr_ptr[k] = path_conv_10_ref;
8221         }
8222         
8223         FREE(path_var.data);
8224         js_invoke_function_uuuuuu(j_calls->instance_ptr, 43, (uint32_t)path_arr, 0, 0, 0, 0, 0);
8225 }
8226 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
8227         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8228         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 44, 0, 0, 0, 0, 0, 0);
8229         LDKCVec_u8Z ret_ref;
8230         ret_ref.datalen = ret->arr_len;
8231         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
8232         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
8233         return ret_ref;
8234 }
8235 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
8236         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
8237         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8238 }
8239 static inline LDKScore LDKScore_init (JSValue o) {
8240         LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
8241         atomic_init(&calls->refcnt, 1);
8242         calls->instance_ptr = o;
8243
8244         LDKScore ret = {
8245                 .this_arg = (void*) calls,
8246                 .channel_penalty_msat = channel_penalty_msat_LDKScore_jcall,
8247                 .payment_path_failed = payment_path_failed_LDKScore_jcall,
8248                 .payment_path_successful = payment_path_successful_LDKScore_jcall,
8249                 .probe_failed = probe_failed_LDKScore_jcall,
8250                 .probe_successful = probe_successful_LDKScore_jcall,
8251                 .write = write_LDKScore_jcall,
8252                 .free = LDKScore_JCalls_free,
8253         };
8254         return ret;
8255 }
8256 uint64_t  __attribute__((export_name("TS_LDKScore_new"))) TS_LDKScore_new(JSValue o) {
8257         LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
8258         *res_ptr = LDKScore_init(o);
8259         return tag_ptr(res_ptr, true);
8260 }
8261 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) {
8262         void* this_arg_ptr = untag_ptr(this_arg);
8263         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8264         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8265         LDKNodeId source_conv;
8266         source_conv.inner = untag_ptr(source);
8267         source_conv.is_owned = ptr_is_owned(source);
8268         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
8269         source_conv.is_owned = false;
8270         LDKNodeId target_conv;
8271         target_conv.inner = untag_ptr(target);
8272         target_conv.is_owned = ptr_is_owned(target);
8273         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
8274         target_conv.is_owned = false;
8275         LDKChannelUsage usage_conv;
8276         usage_conv.inner = untag_ptr(usage);
8277         usage_conv.is_owned = ptr_is_owned(usage);
8278         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_conv);
8279         usage_conv = ChannelUsage_clone(&usage_conv);
8280         int64_t ret_conv = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id, &source_conv, &target_conv, usage_conv);
8281         return ret_conv;
8282 }
8283
8284 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) {
8285         void* this_arg_ptr = untag_ptr(this_arg);
8286         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8287         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8288         LDKCVec_RouteHopZ path_constr;
8289         path_constr.datalen = path->arr_len;
8290         if (path_constr.datalen > 0)
8291                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
8292         else
8293                 path_constr.data = NULL;
8294         uint64_t* path_vals = path->elems;
8295         for (size_t k = 0; k < path_constr.datalen; k++) {
8296                 uint64_t path_conv_10 = path_vals[k];
8297                 LDKRouteHop path_conv_10_conv;
8298                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
8299                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
8300                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
8301                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
8302                 path_constr.data[k] = path_conv_10_conv;
8303         }
8304         FREE(path);
8305         (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
8306 }
8307
8308 void  __attribute__((export_name("TS_Score_payment_path_successful"))) TS_Score_payment_path_successful(uint64_t this_arg, uint64_tArray path) {
8309         void* this_arg_ptr = untag_ptr(this_arg);
8310         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8311         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8312         LDKCVec_RouteHopZ path_constr;
8313         path_constr.datalen = path->arr_len;
8314         if (path_constr.datalen > 0)
8315                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
8316         else
8317                 path_constr.data = NULL;
8318         uint64_t* path_vals = path->elems;
8319         for (size_t k = 0; k < path_constr.datalen; k++) {
8320                 uint64_t path_conv_10 = path_vals[k];
8321                 LDKRouteHop path_conv_10_conv;
8322                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
8323                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
8324                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
8325                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
8326                 path_constr.data[k] = path_conv_10_conv;
8327         }
8328         FREE(path);
8329         (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, path_constr);
8330 }
8331
8332 void  __attribute__((export_name("TS_Score_probe_failed"))) TS_Score_probe_failed(uint64_t this_arg, uint64_tArray path, int64_t short_channel_id) {
8333         void* this_arg_ptr = untag_ptr(this_arg);
8334         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8335         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8336         LDKCVec_RouteHopZ path_constr;
8337         path_constr.datalen = path->arr_len;
8338         if (path_constr.datalen > 0)
8339                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
8340         else
8341                 path_constr.data = NULL;
8342         uint64_t* path_vals = path->elems;
8343         for (size_t k = 0; k < path_constr.datalen; k++) {
8344                 uint64_t path_conv_10 = path_vals[k];
8345                 LDKRouteHop path_conv_10_conv;
8346                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
8347                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
8348                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
8349                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
8350                 path_constr.data[k] = path_conv_10_conv;
8351         }
8352         FREE(path);
8353         (this_arg_conv->probe_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
8354 }
8355
8356 void  __attribute__((export_name("TS_Score_probe_successful"))) TS_Score_probe_successful(uint64_t this_arg, uint64_tArray path) {
8357         void* this_arg_ptr = untag_ptr(this_arg);
8358         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8359         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8360         LDKCVec_RouteHopZ path_constr;
8361         path_constr.datalen = path->arr_len;
8362         if (path_constr.datalen > 0)
8363                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
8364         else
8365                 path_constr.data = NULL;
8366         uint64_t* path_vals = path->elems;
8367         for (size_t k = 0; k < path_constr.datalen; k++) {
8368                 uint64_t path_conv_10 = path_vals[k];
8369                 LDKRouteHop path_conv_10_conv;
8370                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
8371                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
8372                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
8373                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
8374                 path_constr.data[k] = path_conv_10_conv;
8375         }
8376         FREE(path);
8377         (this_arg_conv->probe_successful)(this_arg_conv->this_arg, path_constr);
8378 }
8379
8380 int8_tArray  __attribute__((export_name("TS_Score_write"))) TS_Score_write(uint64_t this_arg) {
8381         void* this_arg_ptr = untag_ptr(this_arg);
8382         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8383         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8384         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
8385         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
8386         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
8387         CVec_u8Z_free(ret_var);
8388         return ret_arr;
8389 }
8390
8391 typedef struct LDKLockableScore_JCalls {
8392         atomic_size_t refcnt;
8393         uint32_t instance_ptr;
8394 } LDKLockableScore_JCalls;
8395 static void LDKLockableScore_JCalls_free(void* this_arg) {
8396         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
8397         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8398                 FREE(j_calls);
8399         }
8400 }
8401 LDKScore lock_LDKLockableScore_jcall(const void* this_arg) {
8402         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
8403         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 45, 0, 0, 0, 0, 0, 0);
8404         void* ret_ptr = untag_ptr(ret);
8405         CHECK_ACCESS(ret_ptr);
8406         LDKScore ret_conv = *(LDKScore*)(ret_ptr);
8407         if (ret_conv.free == LDKScore_JCalls_free) {
8408                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8409                 LDKScore_JCalls_cloned(&ret_conv);
8410         }// WARNING: we may need a move here but no clone is available for LDKScore
8411         
8412         return ret_conv;
8413 }
8414 static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) {
8415         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg;
8416         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8417 }
8418 static inline LDKLockableScore LDKLockableScore_init (JSValue o) {
8419         LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls");
8420         atomic_init(&calls->refcnt, 1);
8421         calls->instance_ptr = o;
8422
8423         LDKLockableScore ret = {
8424                 .this_arg = (void*) calls,
8425                 .lock = lock_LDKLockableScore_jcall,
8426                 .free = LDKLockableScore_JCalls_free,
8427         };
8428         return ret;
8429 }
8430 uint64_t  __attribute__((export_name("TS_LDKLockableScore_new"))) TS_LDKLockableScore_new(JSValue o) {
8431         LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
8432         *res_ptr = LDKLockableScore_init(o);
8433         return tag_ptr(res_ptr, true);
8434 }
8435 uint64_t  __attribute__((export_name("TS_LockableScore_lock"))) TS_LockableScore_lock(uint64_t this_arg) {
8436         void* this_arg_ptr = untag_ptr(this_arg);
8437         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8438         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
8439         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
8440         *ret_ret = (this_arg_conv->lock)(this_arg_conv->this_arg);
8441         return tag_ptr(ret_ret, true);
8442 }
8443
8444 typedef struct LDKWriteableScore_JCalls {
8445         atomic_size_t refcnt;
8446         uint32_t instance_ptr;
8447         LDKLockableScore_JCalls* LockableScore;
8448 } LDKWriteableScore_JCalls;
8449 static void LDKWriteableScore_JCalls_free(void* this_arg) {
8450         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
8451         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8452                 FREE(j_calls);
8453         }
8454 }
8455 LDKCVec_u8Z write_LDKWriteableScore_jcall(const void* this_arg) {
8456         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
8457         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 46, 0, 0, 0, 0, 0, 0);
8458         LDKCVec_u8Z ret_ref;
8459         ret_ref.datalen = ret->arr_len;
8460         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
8461         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
8462         return ret_ref;
8463 }
8464 static void LDKWriteableScore_JCalls_cloned(LDKWriteableScore* new_obj) {
8465         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) new_obj->this_arg;
8466         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8467         atomic_fetch_add_explicit(&j_calls->LockableScore->refcnt, 1, memory_order_release);
8468 }
8469 static inline LDKWriteableScore LDKWriteableScore_init (JSValue o, JSValue LockableScore) {
8470         LDKWriteableScore_JCalls *calls = MALLOC(sizeof(LDKWriteableScore_JCalls), "LDKWriteableScore_JCalls");
8471         atomic_init(&calls->refcnt, 1);
8472         calls->instance_ptr = o;
8473
8474         LDKWriteableScore ret = {
8475                 .this_arg = (void*) calls,
8476                 .write = write_LDKWriteableScore_jcall,
8477                 .free = LDKWriteableScore_JCalls_free,
8478                 .LockableScore = LDKLockableScore_init(LockableScore),
8479         };
8480         calls->LockableScore = ret.LockableScore.this_arg;
8481         return ret;
8482 }
8483 uint64_t  __attribute__((export_name("TS_LDKWriteableScore_new"))) TS_LDKWriteableScore_new(JSValue o, JSValue LockableScore) {
8484         LDKWriteableScore *res_ptr = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
8485         *res_ptr = LDKWriteableScore_init(o, LockableScore);
8486         return tag_ptr(res_ptr, true);
8487 }
8488 int8_tArray  __attribute__((export_name("TS_WriteableScore_write"))) TS_WriteableScore_write(uint64_t this_arg) {
8489         void* this_arg_ptr = untag_ptr(this_arg);
8490         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8491         LDKWriteableScore* this_arg_conv = (LDKWriteableScore*)this_arg_ptr;
8492         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
8493         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
8494         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
8495         CVec_u8Z_free(ret_var);
8496         return ret_arr;
8497 }
8498
8499 typedef struct LDKPersister_JCalls {
8500         atomic_size_t refcnt;
8501         uint32_t instance_ptr;
8502 } LDKPersister_JCalls;
8503 static void LDKPersister_JCalls_free(void* this_arg) {
8504         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
8505         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8506                 FREE(j_calls);
8507         }
8508 }
8509 LDKCResult_NoneErrorZ persist_manager_LDKPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
8510         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
8511         LDKChannelManager channel_manager_var = *channel_manager;
8512         uint64_t channel_manager_ref = 0;
8513         // WARNING: we may need a move here but no clone is available for LDKChannelManager
8514         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_var);
8515         channel_manager_ref = tag_ptr(channel_manager_var.inner, channel_manager_var.is_owned);
8516         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 47, channel_manager_ref, 0, 0, 0, 0, 0);
8517         void* ret_ptr = untag_ptr(ret);
8518         CHECK_ACCESS(ret_ptr);
8519         LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
8520         FREE(untag_ptr(ret));
8521         return ret_conv;
8522 }
8523 LDKCResult_NoneErrorZ persist_graph_LDKPersister_jcall(const void* this_arg, const LDKNetworkGraph * network_graph) {
8524         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
8525         LDKNetworkGraph network_graph_var = *network_graph;
8526         uint64_t network_graph_ref = 0;
8527         // WARNING: we may need a move here but no clone is available for LDKNetworkGraph
8528         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_var);
8529         network_graph_ref = tag_ptr(network_graph_var.inner, network_graph_var.is_owned);
8530         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 48, network_graph_ref, 0, 0, 0, 0, 0);
8531         void* ret_ptr = untag_ptr(ret);
8532         CHECK_ACCESS(ret_ptr);
8533         LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
8534         FREE(untag_ptr(ret));
8535         return ret_conv;
8536 }
8537 LDKCResult_NoneErrorZ persist_scorer_LDKPersister_jcall(const void* this_arg, const LDKWriteableScore * scorer) {
8538         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
8539         // WARNING: This object doesn't live past this scope, needs clone!
8540         uint64_t ret_scorer = tag_ptr(scorer, false);
8541         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 49, ret_scorer, 0, 0, 0, 0, 0);
8542         void* ret_ptr = untag_ptr(ret);
8543         CHECK_ACCESS(ret_ptr);
8544         LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
8545         FREE(untag_ptr(ret));
8546         return ret_conv;
8547 }
8548 static void LDKPersister_JCalls_cloned(LDKPersister* new_obj) {
8549         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) new_obj->this_arg;
8550         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8551 }
8552 static inline LDKPersister LDKPersister_init (JSValue o) {
8553         LDKPersister_JCalls *calls = MALLOC(sizeof(LDKPersister_JCalls), "LDKPersister_JCalls");
8554         atomic_init(&calls->refcnt, 1);
8555         calls->instance_ptr = o;
8556
8557         LDKPersister ret = {
8558                 .this_arg = (void*) calls,
8559                 .persist_manager = persist_manager_LDKPersister_jcall,
8560                 .persist_graph = persist_graph_LDKPersister_jcall,
8561                 .persist_scorer = persist_scorer_LDKPersister_jcall,
8562                 .free = LDKPersister_JCalls_free,
8563         };
8564         return ret;
8565 }
8566 uint64_t  __attribute__((export_name("TS_LDKPersister_new"))) TS_LDKPersister_new(JSValue o) {
8567         LDKPersister *res_ptr = MALLOC(sizeof(LDKPersister), "LDKPersister");
8568         *res_ptr = LDKPersister_init(o);
8569         return tag_ptr(res_ptr, true);
8570 }
8571 uint64_t  __attribute__((export_name("TS_Persister_persist_manager"))) TS_Persister_persist_manager(uint64_t this_arg, uint64_t channel_manager) {
8572         void* this_arg_ptr = untag_ptr(this_arg);
8573         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8574         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
8575         LDKChannelManager channel_manager_conv;
8576         channel_manager_conv.inner = untag_ptr(channel_manager);
8577         channel_manager_conv.is_owned = ptr_is_owned(channel_manager);
8578         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
8579         channel_manager_conv.is_owned = false;
8580         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
8581         *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
8582         return tag_ptr(ret_conv, true);
8583 }
8584
8585 uint64_t  __attribute__((export_name("TS_Persister_persist_graph"))) TS_Persister_persist_graph(uint64_t this_arg, uint64_t network_graph) {
8586         void* this_arg_ptr = untag_ptr(this_arg);
8587         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8588         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
8589         LDKNetworkGraph network_graph_conv;
8590         network_graph_conv.inner = untag_ptr(network_graph);
8591         network_graph_conv.is_owned = ptr_is_owned(network_graph);
8592         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
8593         network_graph_conv.is_owned = false;
8594         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
8595         *ret_conv = (this_arg_conv->persist_graph)(this_arg_conv->this_arg, &network_graph_conv);
8596         return tag_ptr(ret_conv, true);
8597 }
8598
8599 uint64_t  __attribute__((export_name("TS_Persister_persist_scorer"))) TS_Persister_persist_scorer(uint64_t this_arg, uint64_t scorer) {
8600         void* this_arg_ptr = untag_ptr(this_arg);
8601         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8602         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
8603         void* scorer_ptr = untag_ptr(scorer);
8604         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
8605         LDKWriteableScore* scorer_conv = (LDKWriteableScore*)scorer_ptr;
8606         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
8607         *ret_conv = (this_arg_conv->persist_scorer)(this_arg_conv->this_arg, scorer_conv);
8608         return tag_ptr(ret_conv, true);
8609 }
8610
8611 typedef struct LDKFutureCallback_JCalls {
8612         atomic_size_t refcnt;
8613         uint32_t instance_ptr;
8614 } LDKFutureCallback_JCalls;
8615 static void LDKFutureCallback_JCalls_free(void* this_arg) {
8616         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
8617         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8618                 FREE(j_calls);
8619         }
8620 }
8621 void call_LDKFutureCallback_jcall(const void* this_arg) {
8622         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
8623         js_invoke_function_uuuuuu(j_calls->instance_ptr, 50, 0, 0, 0, 0, 0, 0);
8624 }
8625 static void LDKFutureCallback_JCalls_cloned(LDKFutureCallback* new_obj) {
8626         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) new_obj->this_arg;
8627         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8628 }
8629 static inline LDKFutureCallback LDKFutureCallback_init (JSValue o) {
8630         LDKFutureCallback_JCalls *calls = MALLOC(sizeof(LDKFutureCallback_JCalls), "LDKFutureCallback_JCalls");
8631         atomic_init(&calls->refcnt, 1);
8632         calls->instance_ptr = o;
8633
8634         LDKFutureCallback ret = {
8635                 .this_arg = (void*) calls,
8636                 .call = call_LDKFutureCallback_jcall,
8637                 .free = LDKFutureCallback_JCalls_free,
8638         };
8639         return ret;
8640 }
8641 uint64_t  __attribute__((export_name("TS_LDKFutureCallback_new"))) TS_LDKFutureCallback_new(JSValue o) {
8642         LDKFutureCallback *res_ptr = MALLOC(sizeof(LDKFutureCallback), "LDKFutureCallback");
8643         *res_ptr = LDKFutureCallback_init(o);
8644         return tag_ptr(res_ptr, true);
8645 }
8646 void  __attribute__((export_name("TS_FutureCallback_call"))) TS_FutureCallback_call(uint64_t this_arg) {
8647         void* this_arg_ptr = untag_ptr(this_arg);
8648         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8649         LDKFutureCallback* this_arg_conv = (LDKFutureCallback*)this_arg_ptr;
8650         (this_arg_conv->call)(this_arg_conv->this_arg);
8651 }
8652
8653 typedef struct LDKListen_JCalls {
8654         atomic_size_t refcnt;
8655         uint32_t instance_ptr;
8656 } LDKListen_JCalls;
8657 static void LDKListen_JCalls_free(void* this_arg) {
8658         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
8659         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8660                 FREE(j_calls);
8661         }
8662 }
8663 void filtered_block_connected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
8664         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
8665         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
8666         memcpy(header_arr->elems, *header, 80);
8667         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
8668         uint64_tArray txdata_arr = NULL;
8669         txdata_arr = init_uint64_tArray(txdata_var.datalen, __LINE__);
8670         uint64_t *txdata_arr_ptr = (uint64_t*)(((uint8_t*)txdata_arr) + 8);
8671         for (size_t c = 0; c < txdata_var.datalen; c++) {
8672                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
8673                 *txdata_conv_28_conv = txdata_var.data[c];
8674                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
8675         }
8676         
8677         FREE(txdata_var.data);
8678         int32_t height_conv = height;
8679         js_invoke_function_uuuuuu(j_calls->instance_ptr, 51, (uint32_t)header_arr, (uint32_t)txdata_arr, height_conv, 0, 0, 0);
8680 }
8681 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
8682         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
8683         LDKu8slice block_var = block;
8684         int8_tArray block_arr = init_int8_tArray(block_var.datalen, __LINE__);
8685         memcpy(block_arr->elems, block_var.data, block_var.datalen);
8686         int32_t height_conv = height;
8687         js_invoke_function_uuuuuu(j_calls->instance_ptr, 52, (uint32_t)block_arr, height_conv, 0, 0, 0, 0);
8688 }
8689 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
8690         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
8691         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
8692         memcpy(header_arr->elems, *header, 80);
8693         int32_t height_conv = height;
8694         js_invoke_function_uuuuuu(j_calls->instance_ptr, 53, (uint32_t)header_arr, height_conv, 0, 0, 0, 0);
8695 }
8696 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
8697         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
8698         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8699 }
8700 static inline LDKListen LDKListen_init (JSValue o) {
8701         LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
8702         atomic_init(&calls->refcnt, 1);
8703         calls->instance_ptr = o;
8704
8705         LDKListen ret = {
8706                 .this_arg = (void*) calls,
8707                 .filtered_block_connected = filtered_block_connected_LDKListen_jcall,
8708                 .block_connected = block_connected_LDKListen_jcall,
8709                 .block_disconnected = block_disconnected_LDKListen_jcall,
8710                 .free = LDKListen_JCalls_free,
8711         };
8712         return ret;
8713 }
8714 uint64_t  __attribute__((export_name("TS_LDKListen_new"))) TS_LDKListen_new(JSValue o) {
8715         LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
8716         *res_ptr = LDKListen_init(o);
8717         return tag_ptr(res_ptr, true);
8718 }
8719 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) {
8720         void* this_arg_ptr = untag_ptr(this_arg);
8721         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8722         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
8723         unsigned char header_arr[80];
8724         CHECK(header->arr_len == 80);
8725         memcpy(header_arr, header->elems, 80); FREE(header);
8726         unsigned char (*header_ref)[80] = &header_arr;
8727         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
8728         txdata_constr.datalen = txdata->arr_len;
8729         if (txdata_constr.datalen > 0)
8730                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
8731         else
8732                 txdata_constr.data = NULL;
8733         uint64_t* txdata_vals = txdata->elems;
8734         for (size_t c = 0; c < txdata_constr.datalen; c++) {
8735                 uint64_t txdata_conv_28 = txdata_vals[c];
8736                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
8737                 CHECK_ACCESS(txdata_conv_28_ptr);
8738                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
8739                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
8740                 txdata_constr.data[c] = txdata_conv_28_conv;
8741         }
8742         FREE(txdata);
8743         (this_arg_conv->filtered_block_connected)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
8744 }
8745
8746 void  __attribute__((export_name("TS_Listen_block_connected"))) TS_Listen_block_connected(uint64_t this_arg, int8_tArray block, int32_t height) {
8747         void* this_arg_ptr = untag_ptr(this_arg);
8748         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8749         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
8750         LDKu8slice block_ref;
8751         block_ref.datalen = block->arr_len;
8752         block_ref.data = block->elems;
8753         (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
8754         FREE(block);
8755 }
8756
8757 void  __attribute__((export_name("TS_Listen_block_disconnected"))) TS_Listen_block_disconnected(uint64_t this_arg, int8_tArray header, int32_t height) {
8758         void* this_arg_ptr = untag_ptr(this_arg);
8759         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8760         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
8761         unsigned char header_arr[80];
8762         CHECK(header->arr_len == 80);
8763         memcpy(header_arr, header->elems, 80); FREE(header);
8764         unsigned char (*header_ref)[80] = &header_arr;
8765         (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
8766 }
8767
8768 typedef struct LDKConfirm_JCalls {
8769         atomic_size_t refcnt;
8770         uint32_t instance_ptr;
8771 } LDKConfirm_JCalls;
8772 static void LDKConfirm_JCalls_free(void* this_arg) {
8773         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
8774         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8775                 FREE(j_calls);
8776         }
8777 }
8778 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
8779         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
8780         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
8781         memcpy(header_arr->elems, *header, 80);
8782         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
8783         uint64_tArray txdata_arr = NULL;
8784         txdata_arr = init_uint64_tArray(txdata_var.datalen, __LINE__);
8785         uint64_t *txdata_arr_ptr = (uint64_t*)(((uint8_t*)txdata_arr) + 8);
8786         for (size_t c = 0; c < txdata_var.datalen; c++) {
8787                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
8788                 *txdata_conv_28_conv = txdata_var.data[c];
8789                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
8790         }
8791         
8792         FREE(txdata_var.data);
8793         int32_t height_conv = height;
8794         js_invoke_function_uuuuuu(j_calls->instance_ptr, 54, (uint32_t)header_arr, (uint32_t)txdata_arr, height_conv, 0, 0, 0);
8795 }
8796 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
8797         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
8798         int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
8799         memcpy(txid_arr->elems, *txid, 32);
8800         js_invoke_function_uuuuuu(j_calls->instance_ptr, 55, (uint32_t)txid_arr, 0, 0, 0, 0, 0);
8801 }
8802 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
8803         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
8804         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
8805         memcpy(header_arr->elems, *header, 80);
8806         int32_t height_conv = height;
8807         js_invoke_function_uuuuuu(j_calls->instance_ptr, 56, (uint32_t)header_arr, height_conv, 0, 0, 0, 0);
8808 }
8809 LDKCVec_TxidZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
8810         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
8811         ptrArray ret = (ptrArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 57, 0, 0, 0, 0, 0, 0);
8812         LDKCVec_TxidZ ret_constr;
8813         ret_constr.datalen = ret->arr_len;
8814         if (ret_constr.datalen > 0)
8815                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
8816         else
8817                 ret_constr.data = NULL;
8818         int8_tArray* ret_vals = (void*) ret->elems;
8819         for (size_t m = 0; m < ret_constr.datalen; m++) {
8820                 int8_tArray ret_conv_12 = ret_vals[m];
8821                 LDKThirtyTwoBytes ret_conv_12_ref;
8822                 CHECK(ret_conv_12->arr_len == 32);
8823                 memcpy(ret_conv_12_ref.data, ret_conv_12->elems, 32); FREE(ret_conv_12);
8824                 ret_constr.data[m] = ret_conv_12_ref;
8825         }
8826         FREE(ret);
8827         return ret_constr;
8828 }
8829 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
8830         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
8831         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8832 }
8833 static inline LDKConfirm LDKConfirm_init (JSValue o) {
8834         LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
8835         atomic_init(&calls->refcnt, 1);
8836         calls->instance_ptr = o;
8837
8838         LDKConfirm ret = {
8839                 .this_arg = (void*) calls,
8840                 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
8841                 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
8842                 .best_block_updated = best_block_updated_LDKConfirm_jcall,
8843                 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
8844                 .free = LDKConfirm_JCalls_free,
8845         };
8846         return ret;
8847 }
8848 uint64_t  __attribute__((export_name("TS_LDKConfirm_new"))) TS_LDKConfirm_new(JSValue o) {
8849         LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
8850         *res_ptr = LDKConfirm_init(o);
8851         return tag_ptr(res_ptr, true);
8852 }
8853 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) {
8854         void* this_arg_ptr = untag_ptr(this_arg);
8855         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8856         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
8857         unsigned char header_arr[80];
8858         CHECK(header->arr_len == 80);
8859         memcpy(header_arr, header->elems, 80); FREE(header);
8860         unsigned char (*header_ref)[80] = &header_arr;
8861         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
8862         txdata_constr.datalen = txdata->arr_len;
8863         if (txdata_constr.datalen > 0)
8864                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
8865         else
8866                 txdata_constr.data = NULL;
8867         uint64_t* txdata_vals = txdata->elems;
8868         for (size_t c = 0; c < txdata_constr.datalen; c++) {
8869                 uint64_t txdata_conv_28 = txdata_vals[c];
8870                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
8871                 CHECK_ACCESS(txdata_conv_28_ptr);
8872                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
8873                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
8874                 txdata_constr.data[c] = txdata_conv_28_conv;
8875         }
8876         FREE(txdata);
8877         (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
8878 }
8879
8880 void  __attribute__((export_name("TS_Confirm_transaction_unconfirmed"))) TS_Confirm_transaction_unconfirmed(uint64_t this_arg, int8_tArray txid) {
8881         void* this_arg_ptr = untag_ptr(this_arg);
8882         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8883         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
8884         unsigned char txid_arr[32];
8885         CHECK(txid->arr_len == 32);
8886         memcpy(txid_arr, txid->elems, 32); FREE(txid);
8887         unsigned char (*txid_ref)[32] = &txid_arr;
8888         (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
8889 }
8890
8891 void  __attribute__((export_name("TS_Confirm_best_block_updated"))) TS_Confirm_best_block_updated(uint64_t this_arg, int8_tArray header, int32_t height) {
8892         void* this_arg_ptr = untag_ptr(this_arg);
8893         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8894         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
8895         unsigned char header_arr[80];
8896         CHECK(header->arr_len == 80);
8897         memcpy(header_arr, header->elems, 80); FREE(header);
8898         unsigned char (*header_ref)[80] = &header_arr;
8899         (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
8900 }
8901
8902 ptrArray  __attribute__((export_name("TS_Confirm_get_relevant_txids"))) TS_Confirm_get_relevant_txids(uint64_t this_arg) {
8903         void* this_arg_ptr = untag_ptr(this_arg);
8904         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8905         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
8906         LDKCVec_TxidZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
8907         ptrArray ret_arr = NULL;
8908         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
8909         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
8910         for (size_t m = 0; m < ret_var.datalen; m++) {
8911                 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
8912                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
8913                 ret_arr_ptr[m] = ret_conv_12_arr;
8914         }
8915         
8916         FREE(ret_var.data);
8917         return ret_arr;
8918 }
8919
8920 typedef struct LDKPersist_JCalls {
8921         atomic_size_t refcnt;
8922         uint32_t instance_ptr;
8923 } LDKPersist_JCalls;
8924 static void LDKPersist_JCalls_free(void* this_arg) {
8925         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
8926         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8927                 FREE(j_calls);
8928         }
8929 }
8930 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
8931         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
8932         LDKOutPoint channel_id_var = channel_id;
8933         uint64_t channel_id_ref = 0;
8934         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
8935         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
8936         LDKChannelMonitor data_var = *data;
8937         uint64_t data_ref = 0;
8938         data_var = ChannelMonitor_clone(&data_var);
8939         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
8940         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
8941         LDKMonitorUpdateId update_id_var = update_id;
8942         uint64_t update_id_ref = 0;
8943         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
8944         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
8945         uint64_t ret = js_invoke_function_bbbuuu(j_calls->instance_ptr, 58, channel_id_ref, data_ref, update_id_ref, 0, 0, 0);
8946         void* ret_ptr = untag_ptr(ret);
8947         CHECK_ACCESS(ret_ptr);
8948         LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
8949         FREE(untag_ptr(ret));
8950         return ret_conv;
8951 }
8952 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
8953         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
8954         LDKOutPoint channel_id_var = channel_id;
8955         uint64_t channel_id_ref = 0;
8956         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
8957         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
8958         LDKChannelMonitorUpdate update_var = *update;
8959         uint64_t update_ref = 0;
8960         update_var = ChannelMonitorUpdate_clone(&update_var);
8961         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
8962         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
8963         LDKChannelMonitor data_var = *data;
8964         uint64_t data_ref = 0;
8965         data_var = ChannelMonitor_clone(&data_var);
8966         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
8967         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
8968         LDKMonitorUpdateId update_id_var = update_id;
8969         uint64_t update_id_ref = 0;
8970         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
8971         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
8972         uint64_t ret = js_invoke_function_bbbbuu(j_calls->instance_ptr, 59, channel_id_ref, update_ref, data_ref, update_id_ref, 0, 0);
8973         void* ret_ptr = untag_ptr(ret);
8974         CHECK_ACCESS(ret_ptr);
8975         LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
8976         FREE(untag_ptr(ret));
8977         return ret_conv;
8978 }
8979 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
8980         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
8981         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8982 }
8983 static inline LDKPersist LDKPersist_init (JSValue o) {
8984         LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
8985         atomic_init(&calls->refcnt, 1);
8986         calls->instance_ptr = o;
8987
8988         LDKPersist ret = {
8989                 .this_arg = (void*) calls,
8990                 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
8991                 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
8992                 .free = LDKPersist_JCalls_free,
8993         };
8994         return ret;
8995 }
8996 uint64_t  __attribute__((export_name("TS_LDKPersist_new"))) TS_LDKPersist_new(JSValue o) {
8997         LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
8998         *res_ptr = LDKPersist_init(o);
8999         return tag_ptr(res_ptr, true);
9000 }
9001 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) {
9002         void* this_arg_ptr = untag_ptr(this_arg);
9003         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9004         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
9005         LDKOutPoint channel_id_conv;
9006         channel_id_conv.inner = untag_ptr(channel_id);
9007         channel_id_conv.is_owned = ptr_is_owned(channel_id);
9008         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
9009         channel_id_conv = OutPoint_clone(&channel_id_conv);
9010         LDKChannelMonitor data_conv;
9011         data_conv.inner = untag_ptr(data);
9012         data_conv.is_owned = ptr_is_owned(data);
9013         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
9014         data_conv.is_owned = false;
9015         LDKMonitorUpdateId update_id_conv;
9016         update_id_conv.inner = untag_ptr(update_id);
9017         update_id_conv.is_owned = ptr_is_owned(update_id);
9018         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
9019         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
9020         LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
9021         *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, channel_id_conv, &data_conv, update_id_conv);
9022         return tag_ptr(ret_conv, true);
9023 }
9024
9025 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) {
9026         void* this_arg_ptr = untag_ptr(this_arg);
9027         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9028         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
9029         LDKOutPoint channel_id_conv;
9030         channel_id_conv.inner = untag_ptr(channel_id);
9031         channel_id_conv.is_owned = ptr_is_owned(channel_id);
9032         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
9033         channel_id_conv = OutPoint_clone(&channel_id_conv);
9034         LDKChannelMonitorUpdate update_conv;
9035         update_conv.inner = untag_ptr(update);
9036         update_conv.is_owned = ptr_is_owned(update);
9037         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
9038         update_conv.is_owned = false;
9039         LDKChannelMonitor data_conv;
9040         data_conv.inner = untag_ptr(data);
9041         data_conv.is_owned = ptr_is_owned(data);
9042         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
9043         data_conv.is_owned = false;
9044         LDKMonitorUpdateId update_id_conv;
9045         update_id_conv.inner = untag_ptr(update_id);
9046         update_id_conv.is_owned = ptr_is_owned(update_id);
9047         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
9048         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
9049         LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
9050         *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, channel_id_conv, &update_conv, &data_conv, update_id_conv);
9051         return tag_ptr(ret_conv, true);
9052 }
9053
9054 typedef struct LDKChannelMessageHandler_JCalls {
9055         atomic_size_t refcnt;
9056         uint32_t instance_ptr;
9057         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
9058 } LDKChannelMessageHandler_JCalls;
9059 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
9060         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9061         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9062                 FREE(j_calls);
9063         }
9064 }
9065 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
9066         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9067         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9068         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9069         LDKInitFeatures their_features_var = their_features;
9070         uint64_t their_features_ref = 0;
9071         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
9072         their_features_ref = tag_ptr(their_features_var.inner, their_features_var.is_owned);
9073         LDKOpenChannel msg_var = *msg;
9074         uint64_t msg_ref = 0;
9075         msg_var = OpenChannel_clone(&msg_var);
9076         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9077         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9078         js_invoke_function_ubbuuu(j_calls->instance_ptr, 60, (uint32_t)their_node_id_arr, their_features_ref, msg_ref, 0, 0, 0);
9079 }
9080 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
9081         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9082         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9083         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9084         LDKInitFeatures their_features_var = their_features;
9085         uint64_t their_features_ref = 0;
9086         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
9087         their_features_ref = tag_ptr(their_features_var.inner, their_features_var.is_owned);
9088         LDKAcceptChannel msg_var = *msg;
9089         uint64_t msg_ref = 0;
9090         msg_var = AcceptChannel_clone(&msg_var);
9091         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9092         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9093         js_invoke_function_ubbuuu(j_calls->instance_ptr, 61, (uint32_t)their_node_id_arr, their_features_ref, msg_ref, 0, 0, 0);
9094 }
9095 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
9096         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9097         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9098         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9099         LDKFundingCreated msg_var = *msg;
9100         uint64_t msg_ref = 0;
9101         msg_var = FundingCreated_clone(&msg_var);
9102         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9103         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9104         js_invoke_function_ubuuuu(j_calls->instance_ptr, 62, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9105 }
9106 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
9107         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9108         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9109         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9110         LDKFundingSigned msg_var = *msg;
9111         uint64_t msg_ref = 0;
9112         msg_var = FundingSigned_clone(&msg_var);
9113         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9114         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9115         js_invoke_function_ubuuuu(j_calls->instance_ptr, 63, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9116 }
9117 void handle_channel_ready_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReady * msg) {
9118         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9119         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9120         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9121         LDKChannelReady msg_var = *msg;
9122         uint64_t msg_ref = 0;
9123         msg_var = ChannelReady_clone(&msg_var);
9124         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9125         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9126         js_invoke_function_ubuuuu(j_calls->instance_ptr, 64, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9127 }
9128 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
9129         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9130         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9131         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9132         LDKInitFeatures their_features_var = *their_features;
9133         uint64_t their_features_ref = 0;
9134         their_features_var = InitFeatures_clone(&their_features_var);
9135         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
9136         their_features_ref = tag_ptr(their_features_var.inner, their_features_var.is_owned);
9137         LDKShutdown msg_var = *msg;
9138         uint64_t msg_ref = 0;
9139         msg_var = Shutdown_clone(&msg_var);
9140         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9141         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9142         js_invoke_function_ubbuuu(j_calls->instance_ptr, 65, (uint32_t)their_node_id_arr, their_features_ref, msg_ref, 0, 0, 0);
9143 }
9144 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
9145         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9146         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9147         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9148         LDKClosingSigned msg_var = *msg;
9149         uint64_t msg_ref = 0;
9150         msg_var = ClosingSigned_clone(&msg_var);
9151         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9152         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9153         js_invoke_function_ubuuuu(j_calls->instance_ptr, 66, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9154 }
9155 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
9156         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9157         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9158         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9159         LDKUpdateAddHTLC msg_var = *msg;
9160         uint64_t msg_ref = 0;
9161         msg_var = UpdateAddHTLC_clone(&msg_var);
9162         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9163         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9164         js_invoke_function_ubuuuu(j_calls->instance_ptr, 67, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9165 }
9166 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
9167         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9168         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9169         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9170         LDKUpdateFulfillHTLC msg_var = *msg;
9171         uint64_t msg_ref = 0;
9172         msg_var = UpdateFulfillHTLC_clone(&msg_var);
9173         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9174         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9175         js_invoke_function_ubuuuu(j_calls->instance_ptr, 68, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9176 }
9177 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
9178         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9179         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9180         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9181         LDKUpdateFailHTLC msg_var = *msg;
9182         uint64_t msg_ref = 0;
9183         msg_var = UpdateFailHTLC_clone(&msg_var);
9184         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9185         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9186         js_invoke_function_ubuuuu(j_calls->instance_ptr, 69, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9187 }
9188 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
9189         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9190         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9191         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9192         LDKUpdateFailMalformedHTLC msg_var = *msg;
9193         uint64_t msg_ref = 0;
9194         msg_var = UpdateFailMalformedHTLC_clone(&msg_var);
9195         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9196         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9197         js_invoke_function_ubuuuu(j_calls->instance_ptr, 70, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9198 }
9199 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
9200         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9201         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9202         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9203         LDKCommitmentSigned msg_var = *msg;
9204         uint64_t msg_ref = 0;
9205         msg_var = CommitmentSigned_clone(&msg_var);
9206         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9207         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9208         js_invoke_function_ubuuuu(j_calls->instance_ptr, 71, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9209 }
9210 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
9211         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9212         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9213         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9214         LDKRevokeAndACK msg_var = *msg;
9215         uint64_t msg_ref = 0;
9216         msg_var = RevokeAndACK_clone(&msg_var);
9217         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9218         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9219         js_invoke_function_ubuuuu(j_calls->instance_ptr, 72, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9220 }
9221 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
9222         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9223         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9224         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9225         LDKUpdateFee msg_var = *msg;
9226         uint64_t msg_ref = 0;
9227         msg_var = UpdateFee_clone(&msg_var);
9228         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9229         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9230         js_invoke_function_ubuuuu(j_calls->instance_ptr, 73, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9231 }
9232 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
9233         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9234         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9235         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9236         LDKAnnouncementSignatures msg_var = *msg;
9237         uint64_t msg_ref = 0;
9238         msg_var = AnnouncementSignatures_clone(&msg_var);
9239         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9240         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9241         js_invoke_function_ubuuuu(j_calls->instance_ptr, 74, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9242 }
9243 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
9244         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9245         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9246         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9247         jboolean no_connection_possible_conv = no_connection_possible;
9248         js_invoke_function_uuuuuu(j_calls->instance_ptr, 75, (uint32_t)their_node_id_arr, no_connection_possible_conv, 0, 0, 0, 0);
9249 }
9250 void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
9251         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9252         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9253         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9254         LDKInit msg_var = *msg;
9255         uint64_t msg_ref = 0;
9256         msg_var = Init_clone(&msg_var);
9257         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9258         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9259         js_invoke_function_ubuuuu(j_calls->instance_ptr, 76, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9260 }
9261 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
9262         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9263         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9264         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9265         LDKChannelReestablish msg_var = *msg;
9266         uint64_t msg_ref = 0;
9267         msg_var = ChannelReestablish_clone(&msg_var);
9268         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9269         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9270         js_invoke_function_ubuuuu(j_calls->instance_ptr, 77, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9271 }
9272 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
9273         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9274         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9275         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9276         LDKChannelUpdate msg_var = *msg;
9277         uint64_t msg_ref = 0;
9278         msg_var = ChannelUpdate_clone(&msg_var);
9279         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9280         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9281         js_invoke_function_ubuuuu(j_calls->instance_ptr, 78, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9282 }
9283 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
9284         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9285         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9286         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9287         LDKErrorMessage msg_var = *msg;
9288         uint64_t msg_ref = 0;
9289         msg_var = ErrorMessage_clone(&msg_var);
9290         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9291         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9292         js_invoke_function_ubuuuu(j_calls->instance_ptr, 79, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9293 }
9294 LDKNodeFeatures provided_node_features_LDKChannelMessageHandler_jcall(const void* this_arg) {
9295         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9296         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 80, 0, 0, 0, 0, 0, 0);
9297         LDKNodeFeatures ret_conv;
9298         ret_conv.inner = untag_ptr(ret);
9299         ret_conv.is_owned = ptr_is_owned(ret);
9300         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
9301         return ret_conv;
9302 }
9303 LDKInitFeatures provided_init_features_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
9304         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9305         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9306         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9307         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 81, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
9308         LDKInitFeatures ret_conv;
9309         ret_conv.inner = untag_ptr(ret);
9310         ret_conv.is_owned = ptr_is_owned(ret);
9311         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
9312         return ret_conv;
9313 }
9314 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
9315         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
9316         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9317         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
9318 }
9319 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JSValue o, JSValue MessageSendEventsProvider) {
9320         LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
9321         atomic_init(&calls->refcnt, 1);
9322         calls->instance_ptr = o;
9323
9324         LDKChannelMessageHandler ret = {
9325                 .this_arg = (void*) calls,
9326                 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
9327                 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
9328                 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
9329                 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
9330                 .handle_channel_ready = handle_channel_ready_LDKChannelMessageHandler_jcall,
9331                 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
9332                 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
9333                 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
9334                 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
9335                 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
9336                 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
9337                 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
9338                 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
9339                 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
9340                 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
9341                 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
9342                 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
9343                 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
9344                 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
9345                 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
9346                 .provided_node_features = provided_node_features_LDKChannelMessageHandler_jcall,
9347                 .provided_init_features = provided_init_features_LDKChannelMessageHandler_jcall,
9348                 .free = LDKChannelMessageHandler_JCalls_free,
9349                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
9350         };
9351         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
9352         return ret;
9353 }
9354 uint64_t  __attribute__((export_name("TS_LDKChannelMessageHandler_new"))) TS_LDKChannelMessageHandler_new(JSValue o, JSValue MessageSendEventsProvider) {
9355         LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
9356         *res_ptr = LDKChannelMessageHandler_init(o, MessageSendEventsProvider);
9357         return tag_ptr(res_ptr, true);
9358 }
9359 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) {
9360         void* this_arg_ptr = untag_ptr(this_arg);
9361         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9362         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9363         LDKPublicKey their_node_id_ref;
9364         CHECK(their_node_id->arr_len == 33);
9365         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9366         LDKInitFeatures their_features_conv;
9367         their_features_conv.inner = untag_ptr(their_features);
9368         their_features_conv.is_owned = ptr_is_owned(their_features);
9369         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
9370         their_features_conv = InitFeatures_clone(&their_features_conv);
9371         LDKOpenChannel msg_conv;
9372         msg_conv.inner = untag_ptr(msg);
9373         msg_conv.is_owned = ptr_is_owned(msg);
9374         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9375         msg_conv.is_owned = false;
9376         (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
9377 }
9378
9379 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) {
9380         void* this_arg_ptr = untag_ptr(this_arg);
9381         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9382         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9383         LDKPublicKey their_node_id_ref;
9384         CHECK(their_node_id->arr_len == 33);
9385         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9386         LDKInitFeatures their_features_conv;
9387         their_features_conv.inner = untag_ptr(their_features);
9388         their_features_conv.is_owned = ptr_is_owned(their_features);
9389         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
9390         their_features_conv = InitFeatures_clone(&their_features_conv);
9391         LDKAcceptChannel msg_conv;
9392         msg_conv.inner = untag_ptr(msg);
9393         msg_conv.is_owned = ptr_is_owned(msg);
9394         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9395         msg_conv.is_owned = false;
9396         (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
9397 }
9398
9399 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) {
9400         void* this_arg_ptr = untag_ptr(this_arg);
9401         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9402         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9403         LDKPublicKey their_node_id_ref;
9404         CHECK(their_node_id->arr_len == 33);
9405         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9406         LDKFundingCreated msg_conv;
9407         msg_conv.inner = untag_ptr(msg);
9408         msg_conv.is_owned = ptr_is_owned(msg);
9409         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9410         msg_conv.is_owned = false;
9411         (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9412 }
9413
9414 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) {
9415         void* this_arg_ptr = untag_ptr(this_arg);
9416         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9417         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9418         LDKPublicKey their_node_id_ref;
9419         CHECK(their_node_id->arr_len == 33);
9420         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9421         LDKFundingSigned msg_conv;
9422         msg_conv.inner = untag_ptr(msg);
9423         msg_conv.is_owned = ptr_is_owned(msg);
9424         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9425         msg_conv.is_owned = false;
9426         (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9427 }
9428
9429 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) {
9430         void* this_arg_ptr = untag_ptr(this_arg);
9431         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9432         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9433         LDKPublicKey their_node_id_ref;
9434         CHECK(their_node_id->arr_len == 33);
9435         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9436         LDKChannelReady msg_conv;
9437         msg_conv.inner = untag_ptr(msg);
9438         msg_conv.is_owned = ptr_is_owned(msg);
9439         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9440         msg_conv.is_owned = false;
9441         (this_arg_conv->handle_channel_ready)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9442 }
9443
9444 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) {
9445         void* this_arg_ptr = untag_ptr(this_arg);
9446         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9447         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9448         LDKPublicKey their_node_id_ref;
9449         CHECK(their_node_id->arr_len == 33);
9450         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9451         LDKInitFeatures their_features_conv;
9452         their_features_conv.inner = untag_ptr(their_features);
9453         their_features_conv.is_owned = ptr_is_owned(their_features);
9454         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
9455         their_features_conv.is_owned = false;
9456         LDKShutdown msg_conv;
9457         msg_conv.inner = untag_ptr(msg);
9458         msg_conv.is_owned = ptr_is_owned(msg);
9459         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9460         msg_conv.is_owned = false;
9461         (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
9462 }
9463
9464 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) {
9465         void* this_arg_ptr = untag_ptr(this_arg);
9466         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9467         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9468         LDKPublicKey their_node_id_ref;
9469         CHECK(their_node_id->arr_len == 33);
9470         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9471         LDKClosingSigned msg_conv;
9472         msg_conv.inner = untag_ptr(msg);
9473         msg_conv.is_owned = ptr_is_owned(msg);
9474         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9475         msg_conv.is_owned = false;
9476         (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9477 }
9478
9479 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) {
9480         void* this_arg_ptr = untag_ptr(this_arg);
9481         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9482         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9483         LDKPublicKey their_node_id_ref;
9484         CHECK(their_node_id->arr_len == 33);
9485         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9486         LDKUpdateAddHTLC msg_conv;
9487         msg_conv.inner = untag_ptr(msg);
9488         msg_conv.is_owned = ptr_is_owned(msg);
9489         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9490         msg_conv.is_owned = false;
9491         (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9492 }
9493
9494 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) {
9495         void* this_arg_ptr = untag_ptr(this_arg);
9496         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9497         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9498         LDKPublicKey their_node_id_ref;
9499         CHECK(their_node_id->arr_len == 33);
9500         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9501         LDKUpdateFulfillHTLC msg_conv;
9502         msg_conv.inner = untag_ptr(msg);
9503         msg_conv.is_owned = ptr_is_owned(msg);
9504         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9505         msg_conv.is_owned = false;
9506         (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9507 }
9508
9509 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) {
9510         void* this_arg_ptr = untag_ptr(this_arg);
9511         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9512         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9513         LDKPublicKey their_node_id_ref;
9514         CHECK(their_node_id->arr_len == 33);
9515         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9516         LDKUpdateFailHTLC msg_conv;
9517         msg_conv.inner = untag_ptr(msg);
9518         msg_conv.is_owned = ptr_is_owned(msg);
9519         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9520         msg_conv.is_owned = false;
9521         (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9522 }
9523
9524 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) {
9525         void* this_arg_ptr = untag_ptr(this_arg);
9526         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9527         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9528         LDKPublicKey their_node_id_ref;
9529         CHECK(their_node_id->arr_len == 33);
9530         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9531         LDKUpdateFailMalformedHTLC msg_conv;
9532         msg_conv.inner = untag_ptr(msg);
9533         msg_conv.is_owned = ptr_is_owned(msg);
9534         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9535         msg_conv.is_owned = false;
9536         (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9537 }
9538
9539 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) {
9540         void* this_arg_ptr = untag_ptr(this_arg);
9541         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9542         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9543         LDKPublicKey their_node_id_ref;
9544         CHECK(their_node_id->arr_len == 33);
9545         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9546         LDKCommitmentSigned msg_conv;
9547         msg_conv.inner = untag_ptr(msg);
9548         msg_conv.is_owned = ptr_is_owned(msg);
9549         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9550         msg_conv.is_owned = false;
9551         (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9552 }
9553
9554 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) {
9555         void* this_arg_ptr = untag_ptr(this_arg);
9556         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9557         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9558         LDKPublicKey their_node_id_ref;
9559         CHECK(their_node_id->arr_len == 33);
9560         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9561         LDKRevokeAndACK msg_conv;
9562         msg_conv.inner = untag_ptr(msg);
9563         msg_conv.is_owned = ptr_is_owned(msg);
9564         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9565         msg_conv.is_owned = false;
9566         (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9567 }
9568
9569 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) {
9570         void* this_arg_ptr = untag_ptr(this_arg);
9571         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9572         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9573         LDKPublicKey their_node_id_ref;
9574         CHECK(their_node_id->arr_len == 33);
9575         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9576         LDKUpdateFee msg_conv;
9577         msg_conv.inner = untag_ptr(msg);
9578         msg_conv.is_owned = ptr_is_owned(msg);
9579         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9580         msg_conv.is_owned = false;
9581         (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9582 }
9583
9584 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) {
9585         void* this_arg_ptr = untag_ptr(this_arg);
9586         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9587         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9588         LDKPublicKey their_node_id_ref;
9589         CHECK(their_node_id->arr_len == 33);
9590         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9591         LDKAnnouncementSignatures msg_conv;
9592         msg_conv.inner = untag_ptr(msg);
9593         msg_conv.is_owned = ptr_is_owned(msg);
9594         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9595         msg_conv.is_owned = false;
9596         (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9597 }
9598
9599 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) {
9600         void* this_arg_ptr = untag_ptr(this_arg);
9601         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9602         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9603         LDKPublicKey their_node_id_ref;
9604         CHECK(their_node_id->arr_len == 33);
9605         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9606         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
9607 }
9608
9609 void  __attribute__((export_name("TS_ChannelMessageHandler_peer_connected"))) TS_ChannelMessageHandler_peer_connected(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
9610         void* this_arg_ptr = untag_ptr(this_arg);
9611         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9612         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9613         LDKPublicKey their_node_id_ref;
9614         CHECK(their_node_id->arr_len == 33);
9615         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9616         LDKInit msg_conv;
9617         msg_conv.inner = untag_ptr(msg);
9618         msg_conv.is_owned = ptr_is_owned(msg);
9619         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9620         msg_conv.is_owned = false;
9621         (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9622 }
9623
9624 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) {
9625         void* this_arg_ptr = untag_ptr(this_arg);
9626         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9627         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9628         LDKPublicKey their_node_id_ref;
9629         CHECK(their_node_id->arr_len == 33);
9630         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9631         LDKChannelReestablish msg_conv;
9632         msg_conv.inner = untag_ptr(msg);
9633         msg_conv.is_owned = ptr_is_owned(msg);
9634         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9635         msg_conv.is_owned = false;
9636         (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9637 }
9638
9639 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) {
9640         void* this_arg_ptr = untag_ptr(this_arg);
9641         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9642         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9643         LDKPublicKey their_node_id_ref;
9644         CHECK(their_node_id->arr_len == 33);
9645         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9646         LDKChannelUpdate msg_conv;
9647         msg_conv.inner = untag_ptr(msg);
9648         msg_conv.is_owned = ptr_is_owned(msg);
9649         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9650         msg_conv.is_owned = false;
9651         (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9652 }
9653
9654 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_error"))) TS_ChannelMessageHandler_handle_error(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
9655         void* this_arg_ptr = untag_ptr(this_arg);
9656         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9657         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9658         LDKPublicKey their_node_id_ref;
9659         CHECK(their_node_id->arr_len == 33);
9660         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9661         LDKErrorMessage msg_conv;
9662         msg_conv.inner = untag_ptr(msg);
9663         msg_conv.is_owned = ptr_is_owned(msg);
9664         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9665         msg_conv.is_owned = false;
9666         (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9667 }
9668
9669 uint64_t  __attribute__((export_name("TS_ChannelMessageHandler_provided_node_features"))) TS_ChannelMessageHandler_provided_node_features(uint64_t this_arg) {
9670         void* this_arg_ptr = untag_ptr(this_arg);
9671         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9672         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9673         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
9674         uint64_t ret_ref = 0;
9675         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9676         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9677         return ret_ref;
9678 }
9679
9680 uint64_t  __attribute__((export_name("TS_ChannelMessageHandler_provided_init_features"))) TS_ChannelMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
9681         void* this_arg_ptr = untag_ptr(this_arg);
9682         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9683         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9684         LDKPublicKey their_node_id_ref;
9685         CHECK(their_node_id->arr_len == 33);
9686         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9687         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
9688         uint64_t ret_ref = 0;
9689         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9690         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9691         return ret_ref;
9692 }
9693
9694 typedef struct LDKRoutingMessageHandler_JCalls {
9695         atomic_size_t refcnt;
9696         uint32_t instance_ptr;
9697         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
9698 } LDKRoutingMessageHandler_JCalls;
9699 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
9700         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9701         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9702                 FREE(j_calls);
9703         }
9704 }
9705 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
9706         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9707         LDKNodeAnnouncement msg_var = *msg;
9708         uint64_t msg_ref = 0;
9709         msg_var = NodeAnnouncement_clone(&msg_var);
9710         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9711         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9712         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 82, msg_ref, 0, 0, 0, 0, 0);
9713         void* ret_ptr = untag_ptr(ret);
9714         CHECK_ACCESS(ret_ptr);
9715         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
9716         FREE(untag_ptr(ret));
9717         return ret_conv;
9718 }
9719 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
9720         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9721         LDKChannelAnnouncement msg_var = *msg;
9722         uint64_t msg_ref = 0;
9723         msg_var = ChannelAnnouncement_clone(&msg_var);
9724         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9725         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9726         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 83, msg_ref, 0, 0, 0, 0, 0);
9727         void* ret_ptr = untag_ptr(ret);
9728         CHECK_ACCESS(ret_ptr);
9729         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
9730         FREE(untag_ptr(ret));
9731         return ret_conv;
9732 }
9733 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
9734         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9735         LDKChannelUpdate msg_var = *msg;
9736         uint64_t msg_ref = 0;
9737         msg_var = ChannelUpdate_clone(&msg_var);
9738         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9739         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9740         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 84, msg_ref, 0, 0, 0, 0, 0);
9741         void* ret_ptr = untag_ptr(ret);
9742         CHECK_ACCESS(ret_ptr);
9743         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
9744         FREE(untag_ptr(ret));
9745         return ret_conv;
9746 }
9747 LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point) {
9748         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9749         int64_t starting_point_conv = starting_point;
9750         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 85, starting_point_conv, 0, 0, 0, 0, 0);
9751         void* ret_ptr = untag_ptr(ret);
9752         CHECK_ACCESS(ret_ptr);
9753         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(ret_ptr);
9754         FREE(untag_ptr(ret));
9755         return ret_conv;
9756 }
9757 LDKNodeAnnouncement get_next_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point) {
9758         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9759         int8_tArray starting_point_arr = init_int8_tArray(33, __LINE__);
9760         memcpy(starting_point_arr->elems, starting_point.compressed_form, 33);
9761         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 86, (uint32_t)starting_point_arr, 0, 0, 0, 0, 0);
9762         LDKNodeAnnouncement ret_conv;
9763         ret_conv.inner = untag_ptr(ret);
9764         ret_conv.is_owned = ptr_is_owned(ret);
9765         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
9766         return ret_conv;
9767 }
9768 void peer_connected_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
9769         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9770         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9771         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9772         LDKInit init_var = *init;
9773         uint64_t init_ref = 0;
9774         init_var = Init_clone(&init_var);
9775         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
9776         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
9777         js_invoke_function_ubuuuu(j_calls->instance_ptr, 87, (uint32_t)their_node_id_arr, init_ref, 0, 0, 0, 0);
9778 }
9779 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
9780         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9781         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9782         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9783         LDKReplyChannelRange msg_var = msg;
9784         uint64_t msg_ref = 0;
9785         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9786         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9787         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 88, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9788         void* ret_ptr = untag_ptr(ret);
9789         CHECK_ACCESS(ret_ptr);
9790         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
9791         FREE(untag_ptr(ret));
9792         return ret_conv;
9793 }
9794 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
9795         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9796         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9797         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9798         LDKReplyShortChannelIdsEnd msg_var = msg;
9799         uint64_t msg_ref = 0;
9800         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9801         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9802         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 89, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9803         void* ret_ptr = untag_ptr(ret);
9804         CHECK_ACCESS(ret_ptr);
9805         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
9806         FREE(untag_ptr(ret));
9807         return ret_conv;
9808 }
9809 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
9810         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9811         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9812         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9813         LDKQueryChannelRange msg_var = msg;
9814         uint64_t msg_ref = 0;
9815         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9816         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9817         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 90, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9818         void* ret_ptr = untag_ptr(ret);
9819         CHECK_ACCESS(ret_ptr);
9820         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
9821         FREE(untag_ptr(ret));
9822         return ret_conv;
9823 }
9824 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
9825         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9826         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9827         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9828         LDKQueryShortChannelIds msg_var = msg;
9829         uint64_t msg_ref = 0;
9830         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9831         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9832         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 91, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9833         void* ret_ptr = untag_ptr(ret);
9834         CHECK_ACCESS(ret_ptr);
9835         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
9836         FREE(untag_ptr(ret));
9837         return ret_conv;
9838 }
9839 LDKNodeFeatures provided_node_features_LDKRoutingMessageHandler_jcall(const void* this_arg) {
9840         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9841         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 92, 0, 0, 0, 0, 0, 0);
9842         LDKNodeFeatures ret_conv;
9843         ret_conv.inner = untag_ptr(ret);
9844         ret_conv.is_owned = ptr_is_owned(ret);
9845         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
9846         return ret_conv;
9847 }
9848 LDKInitFeatures provided_init_features_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
9849         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9850         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9851         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9852         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 93, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
9853         LDKInitFeatures ret_conv;
9854         ret_conv.inner = untag_ptr(ret);
9855         ret_conv.is_owned = ptr_is_owned(ret);
9856         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
9857         return ret_conv;
9858 }
9859 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
9860         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
9861         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9862         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
9863 }
9864 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JSValue o, JSValue MessageSendEventsProvider) {
9865         LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
9866         atomic_init(&calls->refcnt, 1);
9867         calls->instance_ptr = o;
9868
9869         LDKRoutingMessageHandler ret = {
9870                 .this_arg = (void*) calls,
9871                 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
9872                 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
9873                 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
9874                 .get_next_channel_announcement = get_next_channel_announcement_LDKRoutingMessageHandler_jcall,
9875                 .get_next_node_announcement = get_next_node_announcement_LDKRoutingMessageHandler_jcall,
9876                 .peer_connected = peer_connected_LDKRoutingMessageHandler_jcall,
9877                 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
9878                 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
9879                 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
9880                 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
9881                 .provided_node_features = provided_node_features_LDKRoutingMessageHandler_jcall,
9882                 .provided_init_features = provided_init_features_LDKRoutingMessageHandler_jcall,
9883                 .free = LDKRoutingMessageHandler_JCalls_free,
9884                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
9885         };
9886         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
9887         return ret;
9888 }
9889 uint64_t  __attribute__((export_name("TS_LDKRoutingMessageHandler_new"))) TS_LDKRoutingMessageHandler_new(JSValue o, JSValue MessageSendEventsProvider) {
9890         LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
9891         *res_ptr = LDKRoutingMessageHandler_init(o, MessageSendEventsProvider);
9892         return tag_ptr(res_ptr, true);
9893 }
9894 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_node_announcement"))) TS_RoutingMessageHandler_handle_node_announcement(uint64_t this_arg, uint64_t msg) {
9895         void* this_arg_ptr = untag_ptr(this_arg);
9896         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9897         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9898         LDKNodeAnnouncement msg_conv;
9899         msg_conv.inner = untag_ptr(msg);
9900         msg_conv.is_owned = ptr_is_owned(msg);
9901         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9902         msg_conv.is_owned = false;
9903         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
9904         *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
9905         return tag_ptr(ret_conv, true);
9906 }
9907
9908 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_channel_announcement"))) TS_RoutingMessageHandler_handle_channel_announcement(uint64_t this_arg, uint64_t msg) {
9909         void* this_arg_ptr = untag_ptr(this_arg);
9910         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9911         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9912         LDKChannelAnnouncement msg_conv;
9913         msg_conv.inner = untag_ptr(msg);
9914         msg_conv.is_owned = ptr_is_owned(msg);
9915         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9916         msg_conv.is_owned = false;
9917         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
9918         *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
9919         return tag_ptr(ret_conv, true);
9920 }
9921
9922 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_channel_update"))) TS_RoutingMessageHandler_handle_channel_update(uint64_t this_arg, uint64_t msg) {
9923         void* this_arg_ptr = untag_ptr(this_arg);
9924         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9925         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9926         LDKChannelUpdate msg_conv;
9927         msg_conv.inner = untag_ptr(msg);
9928         msg_conv.is_owned = ptr_is_owned(msg);
9929         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9930         msg_conv.is_owned = false;
9931         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
9932         *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
9933         return tag_ptr(ret_conv, true);
9934 }
9935
9936 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) {
9937         void* this_arg_ptr = untag_ptr(this_arg);
9938         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9939         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9940         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
9941         *ret_copy = (this_arg_conv->get_next_channel_announcement)(this_arg_conv->this_arg, starting_point);
9942         uint64_t ret_ref = tag_ptr(ret_copy, true);
9943         return ret_ref;
9944 }
9945
9946 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) {
9947         void* this_arg_ptr = untag_ptr(this_arg);
9948         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9949         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9950         LDKPublicKey starting_point_ref;
9951         CHECK(starting_point->arr_len == 33);
9952         memcpy(starting_point_ref.compressed_form, starting_point->elems, 33); FREE(starting_point);
9953         LDKNodeAnnouncement ret_var = (this_arg_conv->get_next_node_announcement)(this_arg_conv->this_arg, starting_point_ref);
9954         uint64_t ret_ref = 0;
9955         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9956         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9957         return ret_ref;
9958 }
9959
9960 void  __attribute__((export_name("TS_RoutingMessageHandler_peer_connected"))) TS_RoutingMessageHandler_peer_connected(uint64_t this_arg, int8_tArray their_node_id, uint64_t init) {
9961         void* this_arg_ptr = untag_ptr(this_arg);
9962         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9963         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9964         LDKPublicKey their_node_id_ref;
9965         CHECK(their_node_id->arr_len == 33);
9966         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9967         LDKInit init_conv;
9968         init_conv.inner = untag_ptr(init);
9969         init_conv.is_owned = ptr_is_owned(init);
9970         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
9971         init_conv.is_owned = false;
9972         (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
9973 }
9974
9975 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) {
9976         void* this_arg_ptr = untag_ptr(this_arg);
9977         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9978         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9979         LDKPublicKey their_node_id_ref;
9980         CHECK(their_node_id->arr_len == 33);
9981         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9982         LDKReplyChannelRange msg_conv;
9983         msg_conv.inner = untag_ptr(msg);
9984         msg_conv.is_owned = ptr_is_owned(msg);
9985         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9986         msg_conv = ReplyChannelRange_clone(&msg_conv);
9987         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9988         *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
9989         return tag_ptr(ret_conv, true);
9990 }
9991
9992 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) {
9993         void* this_arg_ptr = untag_ptr(this_arg);
9994         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9995         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9996         LDKPublicKey their_node_id_ref;
9997         CHECK(their_node_id->arr_len == 33);
9998         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9999         LDKReplyShortChannelIdsEnd msg_conv;
10000         msg_conv.inner = untag_ptr(msg);
10001         msg_conv.is_owned = ptr_is_owned(msg);
10002         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10003         msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
10004         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10005         *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
10006         return tag_ptr(ret_conv, true);
10007 }
10008
10009 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) {
10010         void* this_arg_ptr = untag_ptr(this_arg);
10011         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10012         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10013         LDKPublicKey their_node_id_ref;
10014         CHECK(their_node_id->arr_len == 33);
10015         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10016         LDKQueryChannelRange msg_conv;
10017         msg_conv.inner = untag_ptr(msg);
10018         msg_conv.is_owned = ptr_is_owned(msg);
10019         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10020         msg_conv = QueryChannelRange_clone(&msg_conv);
10021         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10022         *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
10023         return tag_ptr(ret_conv, true);
10024 }
10025
10026 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) {
10027         void* this_arg_ptr = untag_ptr(this_arg);
10028         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10029         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10030         LDKPublicKey their_node_id_ref;
10031         CHECK(their_node_id->arr_len == 33);
10032         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10033         LDKQueryShortChannelIds msg_conv;
10034         msg_conv.inner = untag_ptr(msg);
10035         msg_conv.is_owned = ptr_is_owned(msg);
10036         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10037         msg_conv = QueryShortChannelIds_clone(&msg_conv);
10038         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10039         *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
10040         return tag_ptr(ret_conv, true);
10041 }
10042
10043 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_provided_node_features"))) TS_RoutingMessageHandler_provided_node_features(uint64_t this_arg) {
10044         void* this_arg_ptr = untag_ptr(this_arg);
10045         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10046         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10047         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
10048         uint64_t ret_ref = 0;
10049         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10050         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10051         return ret_ref;
10052 }
10053
10054 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_provided_init_features"))) TS_RoutingMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
10055         void* this_arg_ptr = untag_ptr(this_arg);
10056         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10057         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10058         LDKPublicKey their_node_id_ref;
10059         CHECK(their_node_id->arr_len == 33);
10060         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10061         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
10062         uint64_t ret_ref = 0;
10063         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10064         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10065         return ret_ref;
10066 }
10067
10068 typedef struct LDKOnionMessageHandler_JCalls {
10069         atomic_size_t refcnt;
10070         uint32_t instance_ptr;
10071         LDKOnionMessageProvider_JCalls* OnionMessageProvider;
10072 } LDKOnionMessageHandler_JCalls;
10073 static void LDKOnionMessageHandler_JCalls_free(void* this_arg) {
10074         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
10075         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10076                 FREE(j_calls);
10077         }
10078 }
10079 void handle_onion_message_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey peer_node_id, const LDKOnionMessage * msg) {
10080         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
10081         int8_tArray peer_node_id_arr = init_int8_tArray(33, __LINE__);
10082         memcpy(peer_node_id_arr->elems, peer_node_id.compressed_form, 33);
10083         LDKOnionMessage msg_var = *msg;
10084         uint64_t msg_ref = 0;
10085         msg_var = OnionMessage_clone(&msg_var);
10086         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10087         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10088         js_invoke_function_ubuuuu(j_calls->instance_ptr, 94, (uint32_t)peer_node_id_arr, msg_ref, 0, 0, 0, 0);
10089 }
10090 void peer_connected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
10091         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
10092         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10093         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10094         LDKInit init_var = *init;
10095         uint64_t init_ref = 0;
10096         init_var = Init_clone(&init_var);
10097         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
10098         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
10099         js_invoke_function_ubuuuu(j_calls->instance_ptr, 95, (uint32_t)their_node_id_arr, init_ref, 0, 0, 0, 0);
10100 }
10101 void peer_disconnected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
10102         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
10103         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10104         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10105         jboolean no_connection_possible_conv = no_connection_possible;
10106         js_invoke_function_uuuuuu(j_calls->instance_ptr, 96, (uint32_t)their_node_id_arr, no_connection_possible_conv, 0, 0, 0, 0);
10107 }
10108 LDKNodeFeatures provided_node_features_LDKOnionMessageHandler_jcall(const void* this_arg) {
10109         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
10110         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 97, 0, 0, 0, 0, 0, 0);
10111         LDKNodeFeatures ret_conv;
10112         ret_conv.inner = untag_ptr(ret);
10113         ret_conv.is_owned = ptr_is_owned(ret);
10114         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
10115         return ret_conv;
10116 }
10117 LDKInitFeatures provided_init_features_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
10118         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
10119         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10120         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10121         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 98, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
10122         LDKInitFeatures ret_conv;
10123         ret_conv.inner = untag_ptr(ret);
10124         ret_conv.is_owned = ptr_is_owned(ret);
10125         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
10126         return ret_conv;
10127 }
10128 static void LDKOnionMessageHandler_JCalls_cloned(LDKOnionMessageHandler* new_obj) {
10129         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) new_obj->this_arg;
10130         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10131         atomic_fetch_add_explicit(&j_calls->OnionMessageProvider->refcnt, 1, memory_order_release);
10132 }
10133 static inline LDKOnionMessageHandler LDKOnionMessageHandler_init (JSValue o, JSValue OnionMessageProvider) {
10134         LDKOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOnionMessageHandler_JCalls), "LDKOnionMessageHandler_JCalls");
10135         atomic_init(&calls->refcnt, 1);
10136         calls->instance_ptr = o;
10137
10138         LDKOnionMessageHandler ret = {
10139                 .this_arg = (void*) calls,
10140                 .handle_onion_message = handle_onion_message_LDKOnionMessageHandler_jcall,
10141                 .peer_connected = peer_connected_LDKOnionMessageHandler_jcall,
10142                 .peer_disconnected = peer_disconnected_LDKOnionMessageHandler_jcall,
10143                 .provided_node_features = provided_node_features_LDKOnionMessageHandler_jcall,
10144                 .provided_init_features = provided_init_features_LDKOnionMessageHandler_jcall,
10145                 .free = LDKOnionMessageHandler_JCalls_free,
10146                 .OnionMessageProvider = LDKOnionMessageProvider_init(OnionMessageProvider),
10147         };
10148         calls->OnionMessageProvider = ret.OnionMessageProvider.this_arg;
10149         return ret;
10150 }
10151 uint64_t  __attribute__((export_name("TS_LDKOnionMessageHandler_new"))) TS_LDKOnionMessageHandler_new(JSValue o, JSValue OnionMessageProvider) {
10152         LDKOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
10153         *res_ptr = LDKOnionMessageHandler_init(o, OnionMessageProvider);
10154         return tag_ptr(res_ptr, true);
10155 }
10156 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) {
10157         void* this_arg_ptr = untag_ptr(this_arg);
10158         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10159         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
10160         LDKPublicKey peer_node_id_ref;
10161         CHECK(peer_node_id->arr_len == 33);
10162         memcpy(peer_node_id_ref.compressed_form, peer_node_id->elems, 33); FREE(peer_node_id);
10163         LDKOnionMessage msg_conv;
10164         msg_conv.inner = untag_ptr(msg);
10165         msg_conv.is_owned = ptr_is_owned(msg);
10166         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10167         msg_conv.is_owned = false;
10168         (this_arg_conv->handle_onion_message)(this_arg_conv->this_arg, peer_node_id_ref, &msg_conv);
10169 }
10170
10171 void  __attribute__((export_name("TS_OnionMessageHandler_peer_connected"))) TS_OnionMessageHandler_peer_connected(uint64_t this_arg, int8_tArray their_node_id, uint64_t init) {
10172         void* this_arg_ptr = untag_ptr(this_arg);
10173         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10174         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
10175         LDKPublicKey their_node_id_ref;
10176         CHECK(their_node_id->arr_len == 33);
10177         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10178         LDKInit init_conv;
10179         init_conv.inner = untag_ptr(init);
10180         init_conv.is_owned = ptr_is_owned(init);
10181         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
10182         init_conv.is_owned = false;
10183         (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
10184 }
10185
10186 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) {
10187         void* this_arg_ptr = untag_ptr(this_arg);
10188         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10189         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
10190         LDKPublicKey their_node_id_ref;
10191         CHECK(their_node_id->arr_len == 33);
10192         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10193         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
10194 }
10195
10196 uint64_t  __attribute__((export_name("TS_OnionMessageHandler_provided_node_features"))) TS_OnionMessageHandler_provided_node_features(uint64_t this_arg) {
10197         void* this_arg_ptr = untag_ptr(this_arg);
10198         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10199         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
10200         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
10201         uint64_t ret_ref = 0;
10202         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10203         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10204         return ret_ref;
10205 }
10206
10207 uint64_t  __attribute__((export_name("TS_OnionMessageHandler_provided_init_features"))) TS_OnionMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
10208         void* this_arg_ptr = untag_ptr(this_arg);
10209         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10210         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
10211         LDKPublicKey their_node_id_ref;
10212         CHECK(their_node_id->arr_len == 33);
10213         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10214         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
10215         uint64_t ret_ref = 0;
10216         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10217         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10218         return ret_ref;
10219 }
10220
10221 typedef struct LDKCustomMessageReader_JCalls {
10222         atomic_size_t refcnt;
10223         uint32_t instance_ptr;
10224 } LDKCustomMessageReader_JCalls;
10225 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
10226         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
10227         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10228                 FREE(j_calls);
10229         }
10230 }
10231 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
10232         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
10233         int16_t message_type_conv = message_type;
10234         LDKu8slice buffer_var = buffer;
10235         int8_tArray buffer_arr = init_int8_tArray(buffer_var.datalen, __LINE__);
10236         memcpy(buffer_arr->elems, buffer_var.data, buffer_var.datalen);
10237         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 99, message_type_conv, (uint32_t)buffer_arr, 0, 0, 0, 0);
10238         void* ret_ptr = untag_ptr(ret);
10239         CHECK_ACCESS(ret_ptr);
10240         LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
10241         FREE(untag_ptr(ret));
10242         return ret_conv;
10243 }
10244 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
10245         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
10246         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10247 }
10248 static inline LDKCustomMessageReader LDKCustomMessageReader_init (JSValue o) {
10249         LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
10250         atomic_init(&calls->refcnt, 1);
10251         calls->instance_ptr = o;
10252
10253         LDKCustomMessageReader ret = {
10254                 .this_arg = (void*) calls,
10255                 .read = read_LDKCustomMessageReader_jcall,
10256                 .free = LDKCustomMessageReader_JCalls_free,
10257         };
10258         return ret;
10259 }
10260 uint64_t  __attribute__((export_name("TS_LDKCustomMessageReader_new"))) TS_LDKCustomMessageReader_new(JSValue o) {
10261         LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
10262         *res_ptr = LDKCustomMessageReader_init(o);
10263         return tag_ptr(res_ptr, true);
10264 }
10265 uint64_t  __attribute__((export_name("TS_CustomMessageReader_read"))) TS_CustomMessageReader_read(uint64_t this_arg, int16_t message_type, int8_tArray buffer) {
10266         void* this_arg_ptr = untag_ptr(this_arg);
10267         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10268         LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
10269         LDKu8slice buffer_ref;
10270         buffer_ref.datalen = buffer->arr_len;
10271         buffer_ref.data = buffer->elems;
10272         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
10273         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
10274         FREE(buffer);
10275         return tag_ptr(ret_conv, true);
10276 }
10277
10278 typedef struct LDKCustomMessageHandler_JCalls {
10279         atomic_size_t refcnt;
10280         uint32_t instance_ptr;
10281         LDKCustomMessageReader_JCalls* CustomMessageReader;
10282 } LDKCustomMessageHandler_JCalls;
10283 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
10284         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
10285         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10286                 FREE(j_calls);
10287         }
10288 }
10289 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
10290         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
10291         LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
10292         *msg_ret = msg;
10293         int8_tArray sender_node_id_arr = init_int8_tArray(33, __LINE__);
10294         memcpy(sender_node_id_arr->elems, sender_node_id.compressed_form, 33);
10295         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);
10296         void* ret_ptr = untag_ptr(ret);
10297         CHECK_ACCESS(ret_ptr);
10298         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
10299         FREE(untag_ptr(ret));
10300         return ret_conv;
10301 }
10302 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
10303         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
10304         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 101, 0, 0, 0, 0, 0, 0);
10305         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
10306         ret_constr.datalen = ret->arr_len;
10307         if (ret_constr.datalen > 0)
10308                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
10309         else
10310                 ret_constr.data = NULL;
10311         uint64_t* ret_vals = ret->elems;
10312         for (size_t z = 0; z < ret_constr.datalen; z++) {
10313                 uint64_t ret_conv_25 = ret_vals[z];
10314                 void* ret_conv_25_ptr = untag_ptr(ret_conv_25);
10315                 CHECK_ACCESS(ret_conv_25_ptr);
10316                 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
10317                 FREE(untag_ptr(ret_conv_25));
10318                 ret_constr.data[z] = ret_conv_25_conv;
10319         }
10320         FREE(ret);
10321         return ret_constr;
10322 }
10323 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
10324         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
10325         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10326         atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
10327 }
10328 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JSValue o, JSValue CustomMessageReader) {
10329         LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
10330         atomic_init(&calls->refcnt, 1);
10331         calls->instance_ptr = o;
10332
10333         LDKCustomMessageHandler ret = {
10334                 .this_arg = (void*) calls,
10335                 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
10336                 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
10337                 .free = LDKCustomMessageHandler_JCalls_free,
10338                 .CustomMessageReader = LDKCustomMessageReader_init(CustomMessageReader),
10339         };
10340         calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
10341         return ret;
10342 }
10343 uint64_t  __attribute__((export_name("TS_LDKCustomMessageHandler_new"))) TS_LDKCustomMessageHandler_new(JSValue o, JSValue CustomMessageReader) {
10344         LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
10345         *res_ptr = LDKCustomMessageHandler_init(o, CustomMessageReader);
10346         return tag_ptr(res_ptr, true);
10347 }
10348 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) {
10349         void* this_arg_ptr = untag_ptr(this_arg);
10350         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10351         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
10352         void* msg_ptr = untag_ptr(msg);
10353         CHECK_ACCESS(msg_ptr);
10354         LDKType msg_conv = *(LDKType*)(msg_ptr);
10355         if (msg_conv.free == LDKType_JCalls_free) {
10356                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10357                 LDKType_JCalls_cloned(&msg_conv);
10358         }
10359         LDKPublicKey sender_node_id_ref;
10360         CHECK(sender_node_id->arr_len == 33);
10361         memcpy(sender_node_id_ref.compressed_form, sender_node_id->elems, 33); FREE(sender_node_id);
10362         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10363         *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
10364         return tag_ptr(ret_conv, true);
10365 }
10366
10367 uint64_tArray  __attribute__((export_name("TS_CustomMessageHandler_get_and_clear_pending_msg"))) TS_CustomMessageHandler_get_and_clear_pending_msg(uint64_t this_arg) {
10368         void* this_arg_ptr = untag_ptr(this_arg);
10369         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10370         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
10371         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
10372         uint64_tArray ret_arr = NULL;
10373         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
10374         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
10375         for (size_t z = 0; z < ret_var.datalen; z++) {
10376                 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
10377                 *ret_conv_25_conv = ret_var.data[z];
10378                 ret_arr_ptr[z] = tag_ptr(ret_conv_25_conv, true);
10379         }
10380         
10381         FREE(ret_var.data);
10382         return ret_arr;
10383 }
10384
10385 typedef struct LDKSocketDescriptor_JCalls {
10386         atomic_size_t refcnt;
10387         uint32_t instance_ptr;
10388 } LDKSocketDescriptor_JCalls;
10389 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
10390         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10391         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10392                 FREE(j_calls);
10393         }
10394 }
10395 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
10396         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10397         LDKu8slice data_var = data;
10398         int8_tArray data_arr = init_int8_tArray(data_var.datalen, __LINE__);
10399         memcpy(data_arr->elems, data_var.data, data_var.datalen);
10400         jboolean resume_read_conv = resume_read;
10401         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 102, (uint32_t)data_arr, resume_read_conv, 0, 0, 0, 0);
10402 }
10403 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
10404         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10405         js_invoke_function_uuuuuu(j_calls->instance_ptr, 103, 0, 0, 0, 0, 0, 0);
10406 }
10407 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
10408         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10409         LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
10410         *other_arg_clone = SocketDescriptor_clone(other_arg);
10411         return js_invoke_function_buuuuu(j_calls->instance_ptr, 104, tag_ptr(other_arg_clone, true), 0, 0, 0, 0, 0);
10412 }
10413 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
10414         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10415         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 105, 0, 0, 0, 0, 0, 0);
10416 }
10417 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
10418         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
10419         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10420 }
10421 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JSValue o) {
10422         LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
10423         atomic_init(&calls->refcnt, 1);
10424         calls->instance_ptr = o;
10425
10426         LDKSocketDescriptor ret = {
10427                 .this_arg = (void*) calls,
10428                 .send_data = send_data_LDKSocketDescriptor_jcall,
10429                 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
10430                 .eq = eq_LDKSocketDescriptor_jcall,
10431                 .hash = hash_LDKSocketDescriptor_jcall,
10432                 .cloned = LDKSocketDescriptor_JCalls_cloned,
10433                 .free = LDKSocketDescriptor_JCalls_free,
10434         };
10435         return ret;
10436 }
10437 uint64_t  __attribute__((export_name("TS_LDKSocketDescriptor_new"))) TS_LDKSocketDescriptor_new(JSValue o) {
10438         LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
10439         *res_ptr = LDKSocketDescriptor_init(o);
10440         return tag_ptr(res_ptr, true);
10441 }
10442 uint32_t  __attribute__((export_name("TS_SocketDescriptor_send_data"))) TS_SocketDescriptor_send_data(uint64_t this_arg, int8_tArray data, jboolean resume_read) {
10443         void* this_arg_ptr = untag_ptr(this_arg);
10444         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10445         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
10446         LDKu8slice data_ref;
10447         data_ref.datalen = data->arr_len;
10448         data_ref.data = data->elems;
10449         uint32_t ret_conv = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
10450         FREE(data);
10451         return ret_conv;
10452 }
10453
10454 void  __attribute__((export_name("TS_SocketDescriptor_disconnect_socket"))) TS_SocketDescriptor_disconnect_socket(uint64_t this_arg) {
10455         void* this_arg_ptr = untag_ptr(this_arg);
10456         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10457         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
10458         (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
10459 }
10460
10461 int64_t  __attribute__((export_name("TS_SocketDescriptor_hash"))) TS_SocketDescriptor_hash(uint64_t this_arg) {
10462         void* this_arg_ptr = untag_ptr(this_arg);
10463         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10464         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
10465         int64_t ret_conv = (this_arg_conv->hash)(this_arg_conv->this_arg);
10466         return ret_conv;
10467 }
10468
10469 uint32_t __attribute__((export_name("TS_LDKEffectiveCapacity_ty_from_ptr"))) TS_LDKEffectiveCapacity_ty_from_ptr(uint64_t ptr) {
10470         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
10471         switch(obj->tag) {
10472                 case LDKEffectiveCapacity_ExactLiquidity: return 0;
10473                 case LDKEffectiveCapacity_MaximumHTLC: return 1;
10474                 case LDKEffectiveCapacity_Total: return 2;
10475                 case LDKEffectiveCapacity_Infinite: return 3;
10476                 case LDKEffectiveCapacity_Unknown: return 4;
10477                 default: abort();
10478         }
10479 }
10480 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_ExactLiquidity_get_liquidity_msat"))) TS_LDKEffectiveCapacity_ExactLiquidity_get_liquidity_msat(uint64_t ptr) {
10481         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
10482         assert(obj->tag == LDKEffectiveCapacity_ExactLiquidity);
10483                         int64_t liquidity_msat_conv = obj->exact_liquidity.liquidity_msat;
10484         return liquidity_msat_conv;
10485 }
10486 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_MaximumHTLC_get_amount_msat"))) TS_LDKEffectiveCapacity_MaximumHTLC_get_amount_msat(uint64_t ptr) {
10487         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
10488         assert(obj->tag == LDKEffectiveCapacity_MaximumHTLC);
10489                         int64_t amount_msat_conv = obj->maximum_htlc.amount_msat;
10490         return amount_msat_conv;
10491 }
10492 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_Total_get_capacity_msat"))) TS_LDKEffectiveCapacity_Total_get_capacity_msat(uint64_t ptr) {
10493         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
10494         assert(obj->tag == LDKEffectiveCapacity_Total);
10495                         int64_t capacity_msat_conv = obj->total.capacity_msat;
10496         return capacity_msat_conv;
10497 }
10498 uint64_t __attribute__((export_name("TS_LDKEffectiveCapacity_Total_get_htlc_maximum_msat"))) TS_LDKEffectiveCapacity_Total_get_htlc_maximum_msat(uint64_t ptr) {
10499         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
10500         assert(obj->tag == LDKEffectiveCapacity_Total);
10501                         uint64_t htlc_maximum_msat_ref = tag_ptr(&obj->total.htlc_maximum_msat, false);
10502         return htlc_maximum_msat_ref;
10503 }
10504 uint32_t __attribute__((export_name("TS_LDKDestination_ty_from_ptr"))) TS_LDKDestination_ty_from_ptr(uint64_t ptr) {
10505         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
10506         switch(obj->tag) {
10507                 case LDKDestination_Node: return 0;
10508                 case LDKDestination_BlindedRoute: return 1;
10509                 default: abort();
10510         }
10511 }
10512 int8_tArray __attribute__((export_name("TS_LDKDestination_Node_get_node"))) TS_LDKDestination_Node_get_node(uint64_t ptr) {
10513         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
10514         assert(obj->tag == LDKDestination_Node);
10515                         int8_tArray node_arr = init_int8_tArray(33, __LINE__);
10516                         memcpy(node_arr->elems, obj->node.compressed_form, 33);
10517         return node_arr;
10518 }
10519 uint64_t __attribute__((export_name("TS_LDKDestination_BlindedRoute_get_blinded_route"))) TS_LDKDestination_BlindedRoute_get_blinded_route(uint64_t ptr) {
10520         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
10521         assert(obj->tag == LDKDestination_BlindedRoute);
10522                         LDKBlindedRoute blinded_route_var = obj->blinded_route;
10523                         uint64_t blinded_route_ref = 0;
10524                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_route_var);
10525                         blinded_route_ref = tag_ptr(blinded_route_var.inner, false);
10526         return blinded_route_ref;
10527 }
10528 uint32_t __attribute__((export_name("TS_LDKFallback_ty_from_ptr"))) TS_LDKFallback_ty_from_ptr(uint64_t ptr) {
10529         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
10530         switch(obj->tag) {
10531                 case LDKFallback_SegWitProgram: return 0;
10532                 case LDKFallback_PubKeyHash: return 1;
10533                 case LDKFallback_ScriptHash: return 2;
10534                 default: abort();
10535         }
10536 }
10537 int8_t __attribute__((export_name("TS_LDKFallback_SegWitProgram_get_version"))) TS_LDKFallback_SegWitProgram_get_version(uint64_t ptr) {
10538         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
10539         assert(obj->tag == LDKFallback_SegWitProgram);
10540                         uint8_t version_val = obj->seg_wit_program.version._0;
10541         return version_val;
10542 }
10543 int8_tArray __attribute__((export_name("TS_LDKFallback_SegWitProgram_get_program"))) TS_LDKFallback_SegWitProgram_get_program(uint64_t ptr) {
10544         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
10545         assert(obj->tag == LDKFallback_SegWitProgram);
10546                         LDKCVec_u8Z program_var = obj->seg_wit_program.program;
10547                         int8_tArray program_arr = init_int8_tArray(program_var.datalen, __LINE__);
10548                         memcpy(program_arr->elems, program_var.data, program_var.datalen);
10549         return program_arr;
10550 }
10551 int8_tArray __attribute__((export_name("TS_LDKFallback_PubKeyHash_get_pub_key_hash"))) TS_LDKFallback_PubKeyHash_get_pub_key_hash(uint64_t ptr) {
10552         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
10553         assert(obj->tag == LDKFallback_PubKeyHash);
10554                         int8_tArray pub_key_hash_arr = init_int8_tArray(20, __LINE__);
10555                         memcpy(pub_key_hash_arr->elems, obj->pub_key_hash.data, 20);
10556         return pub_key_hash_arr;
10557 }
10558 int8_tArray __attribute__((export_name("TS_LDKFallback_ScriptHash_get_script_hash"))) TS_LDKFallback_ScriptHash_get_script_hash(uint64_t ptr) {
10559         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
10560         assert(obj->tag == LDKFallback_ScriptHash);
10561                         int8_tArray script_hash_arr = init_int8_tArray(20, __LINE__);
10562                         memcpy(script_hash_arr->elems, obj->script_hash.data, 20);
10563         return script_hash_arr;
10564 }
10565 typedef struct LDKPayer_JCalls {
10566         atomic_size_t refcnt;
10567         uint32_t instance_ptr;
10568 } LDKPayer_JCalls;
10569 static void LDKPayer_JCalls_free(void* this_arg) {
10570         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10571         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10572                 FREE(j_calls);
10573         }
10574 }
10575 LDKPublicKey node_id_LDKPayer_jcall(const void* this_arg) {
10576         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10577         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 106, 0, 0, 0, 0, 0, 0);
10578         LDKPublicKey ret_ref;
10579         CHECK(ret->arr_len == 33);
10580         memcpy(ret_ref.compressed_form, ret->elems, 33); FREE(ret);
10581         return ret_ref;
10582 }
10583 LDKCVec_ChannelDetailsZ first_hops_LDKPayer_jcall(const void* this_arg) {
10584         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10585         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 107, 0, 0, 0, 0, 0, 0);
10586         LDKCVec_ChannelDetailsZ ret_constr;
10587         ret_constr.datalen = ret->arr_len;
10588         if (ret_constr.datalen > 0)
10589                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
10590         else
10591                 ret_constr.data = NULL;
10592         uint64_t* ret_vals = ret->elems;
10593         for (size_t q = 0; q < ret_constr.datalen; q++) {
10594                 uint64_t ret_conv_16 = ret_vals[q];
10595                 LDKChannelDetails ret_conv_16_conv;
10596                 ret_conv_16_conv.inner = untag_ptr(ret_conv_16);
10597                 ret_conv_16_conv.is_owned = ptr_is_owned(ret_conv_16);
10598                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_conv);
10599                 ret_constr.data[q] = ret_conv_16_conv;
10600         }
10601         FREE(ret);
10602         return ret_constr;
10603 }
10604 LDKCResult_PaymentIdPaymentSendFailureZ send_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_hash, LDKThirtyTwoBytes payment_secret) {
10605         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10606         LDKRoute route_var = *route;
10607         uint64_t route_ref = 0;
10608         route_var = Route_clone(&route_var);
10609         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
10610         route_ref = tag_ptr(route_var.inner, route_var.is_owned);
10611         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
10612         memcpy(payment_hash_arr->elems, payment_hash.data, 32);
10613         int8_tArray payment_secret_arr = init_int8_tArray(32, __LINE__);
10614         memcpy(payment_secret_arr->elems, payment_secret.data, 32);
10615         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);
10616         void* ret_ptr = untag_ptr(ret);
10617         CHECK_ACCESS(ret_ptr);
10618         LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr);
10619         FREE(untag_ptr(ret));
10620         return ret_conv;
10621 }
10622 LDKCResult_PaymentIdPaymentSendFailureZ send_spontaneous_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_preimage) {
10623         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10624         LDKRoute route_var = *route;
10625         uint64_t route_ref = 0;
10626         route_var = Route_clone(&route_var);
10627         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
10628         route_ref = tag_ptr(route_var.inner, route_var.is_owned);
10629         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
10630         memcpy(payment_preimage_arr->elems, payment_preimage.data, 32);
10631         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 109, route_ref, (uint32_t)payment_preimage_arr, 0, 0, 0, 0);
10632         void* ret_ptr = untag_ptr(ret);
10633         CHECK_ACCESS(ret_ptr);
10634         LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr);
10635         FREE(untag_ptr(ret));
10636         return ret_conv;
10637 }
10638 LDKCResult_NonePaymentSendFailureZ retry_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_id) {
10639         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10640         LDKRoute route_var = *route;
10641         uint64_t route_ref = 0;
10642         route_var = Route_clone(&route_var);
10643         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
10644         route_ref = tag_ptr(route_var.inner, route_var.is_owned);
10645         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
10646         memcpy(payment_id_arr->elems, payment_id.data, 32);
10647         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 110, route_ref, (uint32_t)payment_id_arr, 0, 0, 0, 0);
10648         void* ret_ptr = untag_ptr(ret);
10649         CHECK_ACCESS(ret_ptr);
10650         LDKCResult_NonePaymentSendFailureZ ret_conv = *(LDKCResult_NonePaymentSendFailureZ*)(ret_ptr);
10651         FREE(untag_ptr(ret));
10652         return ret_conv;
10653 }
10654 void abandon_payment_LDKPayer_jcall(const void* this_arg, LDKThirtyTwoBytes payment_id) {
10655         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10656         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
10657         memcpy(payment_id_arr->elems, payment_id.data, 32);
10658         js_invoke_function_uuuuuu(j_calls->instance_ptr, 111, (uint32_t)payment_id_arr, 0, 0, 0, 0, 0);
10659 }
10660 static void LDKPayer_JCalls_cloned(LDKPayer* new_obj) {
10661         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) new_obj->this_arg;
10662         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10663 }
10664 static inline LDKPayer LDKPayer_init (JSValue o) {
10665         LDKPayer_JCalls *calls = MALLOC(sizeof(LDKPayer_JCalls), "LDKPayer_JCalls");
10666         atomic_init(&calls->refcnt, 1);
10667         calls->instance_ptr = o;
10668
10669         LDKPayer ret = {
10670                 .this_arg = (void*) calls,
10671                 .node_id = node_id_LDKPayer_jcall,
10672                 .first_hops = first_hops_LDKPayer_jcall,
10673                 .send_payment = send_payment_LDKPayer_jcall,
10674                 .send_spontaneous_payment = send_spontaneous_payment_LDKPayer_jcall,
10675                 .retry_payment = retry_payment_LDKPayer_jcall,
10676                 .abandon_payment = abandon_payment_LDKPayer_jcall,
10677                 .free = LDKPayer_JCalls_free,
10678         };
10679         return ret;
10680 }
10681 uint64_t  __attribute__((export_name("TS_LDKPayer_new"))) TS_LDKPayer_new(JSValue o) {
10682         LDKPayer *res_ptr = MALLOC(sizeof(LDKPayer), "LDKPayer");
10683         *res_ptr = LDKPayer_init(o);
10684         return tag_ptr(res_ptr, true);
10685 }
10686 int8_tArray  __attribute__((export_name("TS_Payer_node_id"))) TS_Payer_node_id(uint64_t this_arg) {
10687         void* this_arg_ptr = untag_ptr(this_arg);
10688         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10689         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
10690         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
10691         memcpy(ret_arr->elems, (this_arg_conv->node_id)(this_arg_conv->this_arg).compressed_form, 33);
10692         return ret_arr;
10693 }
10694
10695 uint64_tArray  __attribute__((export_name("TS_Payer_first_hops"))) TS_Payer_first_hops(uint64_t this_arg) {
10696         void* this_arg_ptr = untag_ptr(this_arg);
10697         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10698         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
10699         LDKCVec_ChannelDetailsZ ret_var = (this_arg_conv->first_hops)(this_arg_conv->this_arg);
10700         uint64_tArray ret_arr = NULL;
10701         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
10702         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
10703         for (size_t q = 0; q < ret_var.datalen; q++) {
10704                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
10705                 uint64_t ret_conv_16_ref = 0;
10706                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
10707                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
10708                 ret_arr_ptr[q] = ret_conv_16_ref;
10709         }
10710         
10711         FREE(ret_var.data);
10712         return ret_arr;
10713 }
10714
10715 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) {
10716         void* this_arg_ptr = untag_ptr(this_arg);
10717         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10718         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
10719         LDKRoute route_conv;
10720         route_conv.inner = untag_ptr(route);
10721         route_conv.is_owned = ptr_is_owned(route);
10722         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
10723         route_conv.is_owned = false;
10724         LDKThirtyTwoBytes payment_hash_ref;
10725         CHECK(payment_hash->arr_len == 32);
10726         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
10727         LDKThirtyTwoBytes payment_secret_ref;
10728         CHECK(payment_secret->arr_len == 32);
10729         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
10730         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
10731         *ret_conv = (this_arg_conv->send_payment)(this_arg_conv->this_arg, &route_conv, payment_hash_ref, payment_secret_ref);
10732         return tag_ptr(ret_conv, true);
10733 }
10734
10735 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) {
10736         void* this_arg_ptr = untag_ptr(this_arg);
10737         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10738         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
10739         LDKRoute route_conv;
10740         route_conv.inner = untag_ptr(route);
10741         route_conv.is_owned = ptr_is_owned(route);
10742         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
10743         route_conv.is_owned = false;
10744         LDKThirtyTwoBytes payment_preimage_ref;
10745         CHECK(payment_preimage->arr_len == 32);
10746         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
10747         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
10748         *ret_conv = (this_arg_conv->send_spontaneous_payment)(this_arg_conv->this_arg, &route_conv, payment_preimage_ref);
10749         return tag_ptr(ret_conv, true);
10750 }
10751
10752 uint64_t  __attribute__((export_name("TS_Payer_retry_payment"))) TS_Payer_retry_payment(uint64_t this_arg, uint64_t route, int8_tArray payment_id) {
10753         void* this_arg_ptr = untag_ptr(this_arg);
10754         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10755         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
10756         LDKRoute route_conv;
10757         route_conv.inner = untag_ptr(route);
10758         route_conv.is_owned = ptr_is_owned(route);
10759         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
10760         route_conv.is_owned = false;
10761         LDKThirtyTwoBytes payment_id_ref;
10762         CHECK(payment_id->arr_len == 32);
10763         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
10764         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
10765         *ret_conv = (this_arg_conv->retry_payment)(this_arg_conv->this_arg, &route_conv, payment_id_ref);
10766         return tag_ptr(ret_conv, true);
10767 }
10768
10769 void  __attribute__((export_name("TS_Payer_abandon_payment"))) TS_Payer_abandon_payment(uint64_t this_arg, int8_tArray payment_id) {
10770         void* this_arg_ptr = untag_ptr(this_arg);
10771         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10772         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
10773         LDKThirtyTwoBytes payment_id_ref;
10774         CHECK(payment_id->arr_len == 32);
10775         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
10776         (this_arg_conv->abandon_payment)(this_arg_conv->this_arg, payment_id_ref);
10777 }
10778
10779 typedef struct LDKRouter_JCalls {
10780         atomic_size_t refcnt;
10781         uint32_t instance_ptr;
10782 } LDKRouter_JCalls;
10783 static void LDKRouter_JCalls_free(void* this_arg) {
10784         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
10785         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10786                 FREE(j_calls);
10787         }
10788 }
10789 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) {
10790         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
10791         int8_tArray payer_arr = init_int8_tArray(33, __LINE__);
10792         memcpy(payer_arr->elems, payer.compressed_form, 33);
10793         LDKRouteParameters route_params_var = *route_params;
10794         uint64_t route_params_ref = 0;
10795         route_params_var = RouteParameters_clone(&route_params_var);
10796         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
10797         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
10798         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
10799         memcpy(payment_hash_arr->elems, *payment_hash, 32);
10800         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
10801         uint64_tArray first_hops_arr = NULL;
10802         if (first_hops != NULL) {
10803                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
10804                 first_hops_arr = init_uint64_tArray(first_hops_var.datalen, __LINE__);
10805                 uint64_t *first_hops_arr_ptr = (uint64_t*)(((uint8_t*)first_hops_arr) + 8);
10806                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
10807                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
10808                         uint64_t first_hops_conv_16_ref = 0;
10809                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
10810                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
10811                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
10812                 }
10813         
10814         }
10815         LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs;
10816         uint64_t inflight_htlcs_ref = 0;
10817         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
10818         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
10819         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);
10820         void* ret_ptr = untag_ptr(ret);
10821         CHECK_ACCESS(ret_ptr);
10822         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
10823         FREE(untag_ptr(ret));
10824         return ret_conv;
10825 }
10826 void notify_payment_path_failed_LDKRouter_jcall(const void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
10827         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
10828         LDKCVec_RouteHopZ path_var = path;
10829         uint64_tArray path_arr = NULL;
10830         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
10831         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
10832         for (size_t k = 0; k < path_var.datalen; k++) {
10833                 LDKRouteHop path_conv_10_var = path_var.data[k];
10834                 uint64_t path_conv_10_ref = 0;
10835                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
10836                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
10837                 path_arr_ptr[k] = path_conv_10_ref;
10838         }
10839         
10840         FREE(path_var.data);
10841         int64_t short_channel_id_conv = short_channel_id;
10842         js_invoke_function_ubuuuu(j_calls->instance_ptr, 113, (uint32_t)path_arr, short_channel_id_conv, 0, 0, 0, 0);
10843 }
10844 void notify_payment_path_successful_LDKRouter_jcall(const void* this_arg, LDKCVec_RouteHopZ path) {
10845         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
10846         LDKCVec_RouteHopZ path_var = path;
10847         uint64_tArray path_arr = NULL;
10848         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
10849         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
10850         for (size_t k = 0; k < path_var.datalen; k++) {
10851                 LDKRouteHop path_conv_10_var = path_var.data[k];
10852                 uint64_t path_conv_10_ref = 0;
10853                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
10854                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
10855                 path_arr_ptr[k] = path_conv_10_ref;
10856         }
10857         
10858         FREE(path_var.data);
10859         js_invoke_function_uuuuuu(j_calls->instance_ptr, 114, (uint32_t)path_arr, 0, 0, 0, 0, 0);
10860 }
10861 void notify_payment_probe_successful_LDKRouter_jcall(const void* this_arg, LDKCVec_RouteHopZ path) {
10862         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
10863         LDKCVec_RouteHopZ path_var = path;
10864         uint64_tArray path_arr = NULL;
10865         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
10866         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
10867         for (size_t k = 0; k < path_var.datalen; k++) {
10868                 LDKRouteHop path_conv_10_var = path_var.data[k];
10869                 uint64_t path_conv_10_ref = 0;
10870                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
10871                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
10872                 path_arr_ptr[k] = path_conv_10_ref;
10873         }
10874         
10875         FREE(path_var.data);
10876         js_invoke_function_uuuuuu(j_calls->instance_ptr, 115, (uint32_t)path_arr, 0, 0, 0, 0, 0);
10877 }
10878 void notify_payment_probe_failed_LDKRouter_jcall(const void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
10879         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
10880         LDKCVec_RouteHopZ path_var = path;
10881         uint64_tArray path_arr = NULL;
10882         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
10883         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
10884         for (size_t k = 0; k < path_var.datalen; k++) {
10885                 LDKRouteHop path_conv_10_var = path_var.data[k];
10886                 uint64_t path_conv_10_ref = 0;
10887                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
10888                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
10889                 path_arr_ptr[k] = path_conv_10_ref;
10890         }
10891         
10892         FREE(path_var.data);
10893         int64_t short_channel_id_conv = short_channel_id;
10894         js_invoke_function_ubuuuu(j_calls->instance_ptr, 116, (uint32_t)path_arr, short_channel_id_conv, 0, 0, 0, 0);
10895 }
10896 static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) {
10897         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg;
10898         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10899 }
10900 static inline LDKRouter LDKRouter_init (JSValue o) {
10901         LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls");
10902         atomic_init(&calls->refcnt, 1);
10903         calls->instance_ptr = o;
10904
10905         LDKRouter ret = {
10906                 .this_arg = (void*) calls,
10907                 .find_route = find_route_LDKRouter_jcall,
10908                 .notify_payment_path_failed = notify_payment_path_failed_LDKRouter_jcall,
10909                 .notify_payment_path_successful = notify_payment_path_successful_LDKRouter_jcall,
10910                 .notify_payment_probe_successful = notify_payment_probe_successful_LDKRouter_jcall,
10911                 .notify_payment_probe_failed = notify_payment_probe_failed_LDKRouter_jcall,
10912                 .free = LDKRouter_JCalls_free,
10913         };
10914         return ret;
10915 }
10916 uint64_t  __attribute__((export_name("TS_LDKRouter_new"))) TS_LDKRouter_new(JSValue o) {
10917         LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter");
10918         *res_ptr = LDKRouter_init(o);
10919         return tag_ptr(res_ptr, true);
10920 }
10921 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) {
10922         void* this_arg_ptr = untag_ptr(this_arg);
10923         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10924         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
10925         LDKPublicKey payer_ref;
10926         CHECK(payer->arr_len == 33);
10927         memcpy(payer_ref.compressed_form, payer->elems, 33); FREE(payer);
10928         LDKRouteParameters route_params_conv;
10929         route_params_conv.inner = untag_ptr(route_params);
10930         route_params_conv.is_owned = ptr_is_owned(route_params);
10931         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
10932         route_params_conv.is_owned = false;
10933         unsigned char payment_hash_arr[32];
10934         CHECK(payment_hash->arr_len == 32);
10935         memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
10936         unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
10937         LDKCVec_ChannelDetailsZ first_hops_constr;
10938         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
10939         if (first_hops != 0) {
10940                 first_hops_constr.datalen = first_hops->arr_len;
10941                 if (first_hops_constr.datalen > 0)
10942                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
10943                 else
10944                         first_hops_constr.data = NULL;
10945                 uint64_t* first_hops_vals = first_hops->elems;
10946                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
10947                         uint64_t first_hops_conv_16 = first_hops_vals[q];
10948                         LDKChannelDetails first_hops_conv_16_conv;
10949                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
10950                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
10951                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
10952                         first_hops_conv_16_conv.is_owned = false;
10953                         first_hops_constr.data[q] = first_hops_conv_16_conv;
10954                 }
10955                 FREE(first_hops);
10956                 first_hops_ptr = &first_hops_constr;
10957         }
10958         LDKInFlightHtlcs inflight_htlcs_conv;
10959         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
10960         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
10961         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
10962         // WARNING: we need a move here but no clone is available for LDKInFlightHtlcs
10963         
10964         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
10965         *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);
10966         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
10967         return tag_ptr(ret_conv, true);
10968 }
10969
10970 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) {
10971         void* this_arg_ptr = untag_ptr(this_arg);
10972         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10973         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
10974         LDKCVec_RouteHopZ path_constr;
10975         path_constr.datalen = path->arr_len;
10976         if (path_constr.datalen > 0)
10977                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
10978         else
10979                 path_constr.data = NULL;
10980         uint64_t* path_vals = path->elems;
10981         for (size_t k = 0; k < path_constr.datalen; k++) {
10982                 uint64_t path_conv_10 = path_vals[k];
10983                 LDKRouteHop path_conv_10_conv;
10984                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
10985                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
10986                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
10987                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
10988                 path_constr.data[k] = path_conv_10_conv;
10989         }
10990         FREE(path);
10991         (this_arg_conv->notify_payment_path_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
10992 }
10993
10994 void  __attribute__((export_name("TS_Router_notify_payment_path_successful"))) TS_Router_notify_payment_path_successful(uint64_t this_arg, uint64_tArray path) {
10995         void* this_arg_ptr = untag_ptr(this_arg);
10996         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10997         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
10998         LDKCVec_RouteHopZ path_constr;
10999         path_constr.datalen = path->arr_len;
11000         if (path_constr.datalen > 0)
11001                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
11002         else
11003                 path_constr.data = NULL;
11004         uint64_t* path_vals = path->elems;
11005         for (size_t k = 0; k < path_constr.datalen; k++) {
11006                 uint64_t path_conv_10 = path_vals[k];
11007                 LDKRouteHop path_conv_10_conv;
11008                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
11009                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
11010                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
11011                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
11012                 path_constr.data[k] = path_conv_10_conv;
11013         }
11014         FREE(path);
11015         (this_arg_conv->notify_payment_path_successful)(this_arg_conv->this_arg, path_constr);
11016 }
11017
11018 void  __attribute__((export_name("TS_Router_notify_payment_probe_successful"))) TS_Router_notify_payment_probe_successful(uint64_t this_arg, uint64_tArray path) {
11019         void* this_arg_ptr = untag_ptr(this_arg);
11020         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11021         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
11022         LDKCVec_RouteHopZ path_constr;
11023         path_constr.datalen = path->arr_len;
11024         if (path_constr.datalen > 0)
11025                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
11026         else
11027                 path_constr.data = NULL;
11028         uint64_t* path_vals = path->elems;
11029         for (size_t k = 0; k < path_constr.datalen; k++) {
11030                 uint64_t path_conv_10 = path_vals[k];
11031                 LDKRouteHop path_conv_10_conv;
11032                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
11033                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
11034                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
11035                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
11036                 path_constr.data[k] = path_conv_10_conv;
11037         }
11038         FREE(path);
11039         (this_arg_conv->notify_payment_probe_successful)(this_arg_conv->this_arg, path_constr);
11040 }
11041
11042 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) {
11043         void* this_arg_ptr = untag_ptr(this_arg);
11044         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11045         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
11046         LDKCVec_RouteHopZ path_constr;
11047         path_constr.datalen = path->arr_len;
11048         if (path_constr.datalen > 0)
11049                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
11050         else
11051                 path_constr.data = NULL;
11052         uint64_t* path_vals = path->elems;
11053         for (size_t k = 0; k < path_constr.datalen; k++) {
11054                 uint64_t path_conv_10 = path_vals[k];
11055                 LDKRouteHop path_conv_10_conv;
11056                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
11057                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
11058                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
11059                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
11060                 path_constr.data[k] = path_conv_10_conv;
11061         }
11062         FREE(path);
11063         (this_arg_conv->notify_payment_probe_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
11064 }
11065
11066 uint32_t __attribute__((export_name("TS_LDKRetry_ty_from_ptr"))) TS_LDKRetry_ty_from_ptr(uint64_t ptr) {
11067         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
11068         switch(obj->tag) {
11069                 case LDKRetry_Attempts: return 0;
11070                 default: abort();
11071         }
11072 }
11073 uint32_t __attribute__((export_name("TS_LDKRetry_Attempts_get_attempts"))) TS_LDKRetry_Attempts_get_attempts(uint64_t ptr) {
11074         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
11075         assert(obj->tag == LDKRetry_Attempts);
11076                         uint32_t attempts_conv = obj->attempts;
11077         return attempts_conv;
11078 }
11079 jstring  __attribute__((export_name("TS__ldk_get_compiled_version"))) TS__ldk_get_compiled_version() {
11080         LDKStr ret_str = _ldk_get_compiled_version();
11081         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
11082         Str_free(ret_str);
11083         return ret_conv;
11084 }
11085
11086 jstring  __attribute__((export_name("TS__ldk_c_bindings_get_compiled_version"))) TS__ldk_c_bindings_get_compiled_version() {
11087         LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
11088         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
11089         Str_free(ret_str);
11090         return ret_conv;
11091 }
11092
11093 uint64_t  __attribute__((export_name("TS_BigEndianScalar_new"))) TS_BigEndianScalar_new(int8_tArray big_endian_bytes) {
11094         LDKThirtyTwoBytes big_endian_bytes_ref;
11095         CHECK(big_endian_bytes->arr_len == 32);
11096         memcpy(big_endian_bytes_ref.data, big_endian_bytes->elems, 32); FREE(big_endian_bytes);
11097         LDKBigEndianScalar* ret_ref = MALLOC(sizeof(LDKBigEndianScalar), "LDKBigEndianScalar");
11098         *ret_ref = BigEndianScalar_new(big_endian_bytes_ref);
11099         return tag_ptr(ret_ref, true);
11100 }
11101
11102 static inline uint64_t Bech32Error_clone_ptr(LDKBech32Error *NONNULL_PTR arg) {
11103         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
11104         *ret_copy = Bech32Error_clone(arg);
11105         uint64_t ret_ref = tag_ptr(ret_copy, true);
11106         return ret_ref;
11107 }
11108 int64_t  __attribute__((export_name("TS_Bech32Error_clone_ptr"))) TS_Bech32Error_clone_ptr(uint64_t arg) {
11109         LDKBech32Error* arg_conv = (LDKBech32Error*)untag_ptr(arg);
11110         int64_t ret_conv = Bech32Error_clone_ptr(arg_conv);
11111         return ret_conv;
11112 }
11113
11114 uint64_t  __attribute__((export_name("TS_Bech32Error_clone"))) TS_Bech32Error_clone(uint64_t orig) {
11115         LDKBech32Error* orig_conv = (LDKBech32Error*)untag_ptr(orig);
11116         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
11117         *ret_copy = Bech32Error_clone(orig_conv);
11118         uint64_t ret_ref = tag_ptr(ret_copy, true);
11119         return ret_ref;
11120 }
11121
11122 void  __attribute__((export_name("TS_Bech32Error_free"))) TS_Bech32Error_free(uint64_t o) {
11123         if (!ptr_is_owned(o)) return;
11124         void* o_ptr = untag_ptr(o);
11125         CHECK_ACCESS(o_ptr);
11126         LDKBech32Error o_conv = *(LDKBech32Error*)(o_ptr);
11127         FREE(untag_ptr(o));
11128         Bech32Error_free(o_conv);
11129 }
11130
11131 void  __attribute__((export_name("TS_Transaction_free"))) TS_Transaction_free(int8_tArray _res) {
11132         LDKTransaction _res_ref;
11133         _res_ref.datalen = _res->arr_len;
11134         _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
11135         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
11136         _res_ref.data_is_owned = true;
11137         Transaction_free(_res_ref);
11138 }
11139
11140 uint64_t  __attribute__((export_name("TS_TxOut_new"))) TS_TxOut_new(int8_tArray script_pubkey, int64_t value) {
11141         LDKCVec_u8Z script_pubkey_ref;
11142         script_pubkey_ref.datalen = script_pubkey->arr_len;
11143         script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
11144         memcpy(script_pubkey_ref.data, script_pubkey->elems, script_pubkey_ref.datalen); FREE(script_pubkey);
11145         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
11146         *ret_ref = TxOut_new(script_pubkey_ref, value);
11147         return tag_ptr(ret_ref, true);
11148 }
11149
11150 void  __attribute__((export_name("TS_TxOut_free"))) TS_TxOut_free(uint64_t _res) {
11151         if (!ptr_is_owned(_res)) return;
11152         void* _res_ptr = untag_ptr(_res);
11153         CHECK_ACCESS(_res_ptr);
11154         LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
11155         FREE(untag_ptr(_res));
11156         TxOut_free(_res_conv);
11157 }
11158
11159 static inline uint64_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
11160         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
11161         *ret_ref = TxOut_clone(arg);
11162         return tag_ptr(ret_ref, true);
11163 }
11164 int64_t  __attribute__((export_name("TS_TxOut_clone_ptr"))) TS_TxOut_clone_ptr(uint64_t arg) {
11165         LDKTxOut* arg_conv = (LDKTxOut*)untag_ptr(arg);
11166         int64_t ret_conv = TxOut_clone_ptr(arg_conv);
11167         return ret_conv;
11168 }
11169
11170 uint64_t  __attribute__((export_name("TS_TxOut_clone"))) TS_TxOut_clone(uint64_t orig) {
11171         LDKTxOut* orig_conv = (LDKTxOut*)untag_ptr(orig);
11172         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
11173         *ret_ref = TxOut_clone(orig_conv);
11174         return tag_ptr(ret_ref, true);
11175 }
11176
11177 void  __attribute__((export_name("TS_Str_free"))) TS_Str_free(jstring _res) {
11178         LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
11179         Str_free(dummy);
11180 }
11181
11182 void  __attribute__((export_name("TS_CVec_PublicKeyZ_free"))) TS_CVec_PublicKeyZ_free(ptrArray _res) {
11183         LDKCVec_PublicKeyZ _res_constr;
11184         _res_constr.datalen = _res->arr_len;
11185         if (_res_constr.datalen > 0)
11186                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
11187         else
11188                 _res_constr.data = NULL;
11189         int8_tArray* _res_vals = (void*) _res->elems;
11190         for (size_t m = 0; m < _res_constr.datalen; m++) {
11191                 int8_tArray _res_conv_12 = _res_vals[m];
11192                 LDKPublicKey _res_conv_12_ref;
11193                 CHECK(_res_conv_12->arr_len == 33);
11194                 memcpy(_res_conv_12_ref.compressed_form, _res_conv_12->elems, 33); FREE(_res_conv_12);
11195                 _res_constr.data[m] = _res_conv_12_ref;
11196         }
11197         FREE(_res);
11198         CVec_PublicKeyZ_free(_res_constr);
11199 }
11200
11201 uint64_t  __attribute__((export_name("TS_CResult_BlindedRouteNoneZ_ok"))) TS_CResult_BlindedRouteNoneZ_ok(uint64_t o) {
11202         LDKBlindedRoute o_conv;
11203         o_conv.inner = untag_ptr(o);
11204         o_conv.is_owned = ptr_is_owned(o);
11205         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11206         // WARNING: we need a move here but no clone is available for LDKBlindedRoute
11207         
11208         LDKCResult_BlindedRouteNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedRouteNoneZ), "LDKCResult_BlindedRouteNoneZ");
11209         *ret_conv = CResult_BlindedRouteNoneZ_ok(o_conv);
11210         return tag_ptr(ret_conv, true);
11211 }
11212
11213 uint64_t  __attribute__((export_name("TS_CResult_BlindedRouteNoneZ_err"))) TS_CResult_BlindedRouteNoneZ_err() {
11214         LDKCResult_BlindedRouteNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedRouteNoneZ), "LDKCResult_BlindedRouteNoneZ");
11215         *ret_conv = CResult_BlindedRouteNoneZ_err();
11216         return tag_ptr(ret_conv, true);
11217 }
11218
11219 jboolean  __attribute__((export_name("TS_CResult_BlindedRouteNoneZ_is_ok"))) TS_CResult_BlindedRouteNoneZ_is_ok(uint64_t o) {
11220         LDKCResult_BlindedRouteNoneZ* o_conv = (LDKCResult_BlindedRouteNoneZ*)untag_ptr(o);
11221         jboolean ret_conv = CResult_BlindedRouteNoneZ_is_ok(o_conv);
11222         return ret_conv;
11223 }
11224
11225 void  __attribute__((export_name("TS_CResult_BlindedRouteNoneZ_free"))) TS_CResult_BlindedRouteNoneZ_free(uint64_t _res) {
11226         if (!ptr_is_owned(_res)) return;
11227         void* _res_ptr = untag_ptr(_res);
11228         CHECK_ACCESS(_res_ptr);
11229         LDKCResult_BlindedRouteNoneZ _res_conv = *(LDKCResult_BlindedRouteNoneZ*)(_res_ptr);
11230         FREE(untag_ptr(_res));
11231         CResult_BlindedRouteNoneZ_free(_res_conv);
11232 }
11233
11234 uint64_t  __attribute__((export_name("TS_CResult_BlindedRouteDecodeErrorZ_ok"))) TS_CResult_BlindedRouteDecodeErrorZ_ok(uint64_t o) {
11235         LDKBlindedRoute o_conv;
11236         o_conv.inner = untag_ptr(o);
11237         o_conv.is_owned = ptr_is_owned(o);
11238         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11239         // WARNING: we need a move here but no clone is available for LDKBlindedRoute
11240         
11241         LDKCResult_BlindedRouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedRouteDecodeErrorZ), "LDKCResult_BlindedRouteDecodeErrorZ");
11242         *ret_conv = CResult_BlindedRouteDecodeErrorZ_ok(o_conv);
11243         return tag_ptr(ret_conv, true);
11244 }
11245
11246 uint64_t  __attribute__((export_name("TS_CResult_BlindedRouteDecodeErrorZ_err"))) TS_CResult_BlindedRouteDecodeErrorZ_err(uint64_t e) {
11247         LDKDecodeError e_conv;
11248         e_conv.inner = untag_ptr(e);
11249         e_conv.is_owned = ptr_is_owned(e);
11250         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11251         e_conv = DecodeError_clone(&e_conv);
11252         LDKCResult_BlindedRouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedRouteDecodeErrorZ), "LDKCResult_BlindedRouteDecodeErrorZ");
11253         *ret_conv = CResult_BlindedRouteDecodeErrorZ_err(e_conv);
11254         return tag_ptr(ret_conv, true);
11255 }
11256
11257 jboolean  __attribute__((export_name("TS_CResult_BlindedRouteDecodeErrorZ_is_ok"))) TS_CResult_BlindedRouteDecodeErrorZ_is_ok(uint64_t o) {
11258         LDKCResult_BlindedRouteDecodeErrorZ* o_conv = (LDKCResult_BlindedRouteDecodeErrorZ*)untag_ptr(o);
11259         jboolean ret_conv = CResult_BlindedRouteDecodeErrorZ_is_ok(o_conv);
11260         return ret_conv;
11261 }
11262
11263 void  __attribute__((export_name("TS_CResult_BlindedRouteDecodeErrorZ_free"))) TS_CResult_BlindedRouteDecodeErrorZ_free(uint64_t _res) {
11264         if (!ptr_is_owned(_res)) return;
11265         void* _res_ptr = untag_ptr(_res);
11266         CHECK_ACCESS(_res_ptr);
11267         LDKCResult_BlindedRouteDecodeErrorZ _res_conv = *(LDKCResult_BlindedRouteDecodeErrorZ*)(_res_ptr);
11268         FREE(untag_ptr(_res));
11269         CResult_BlindedRouteDecodeErrorZ_free(_res_conv);
11270 }
11271
11272 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_ok"))) TS_CResult_BlindedHopDecodeErrorZ_ok(uint64_t o) {
11273         LDKBlindedHop o_conv;
11274         o_conv.inner = untag_ptr(o);
11275         o_conv.is_owned = ptr_is_owned(o);
11276         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11277         // WARNING: we need a move here but no clone is available for LDKBlindedHop
11278         
11279         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
11280         *ret_conv = CResult_BlindedHopDecodeErrorZ_ok(o_conv);
11281         return tag_ptr(ret_conv, true);
11282 }
11283
11284 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_err"))) TS_CResult_BlindedHopDecodeErrorZ_err(uint64_t e) {
11285         LDKDecodeError e_conv;
11286         e_conv.inner = untag_ptr(e);
11287         e_conv.is_owned = ptr_is_owned(e);
11288         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11289         e_conv = DecodeError_clone(&e_conv);
11290         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
11291         *ret_conv = CResult_BlindedHopDecodeErrorZ_err(e_conv);
11292         return tag_ptr(ret_conv, true);
11293 }
11294
11295 jboolean  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_is_ok"))) TS_CResult_BlindedHopDecodeErrorZ_is_ok(uint64_t o) {
11296         LDKCResult_BlindedHopDecodeErrorZ* o_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(o);
11297         jboolean ret_conv = CResult_BlindedHopDecodeErrorZ_is_ok(o_conv);
11298         return ret_conv;
11299 }
11300
11301 void  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_free"))) TS_CResult_BlindedHopDecodeErrorZ_free(uint64_t _res) {
11302         if (!ptr_is_owned(_res)) return;
11303         void* _res_ptr = untag_ptr(_res);
11304         CHECK_ACCESS(_res_ptr);
11305         LDKCResult_BlindedHopDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopDecodeErrorZ*)(_res_ptr);
11306         FREE(untag_ptr(_res));
11307         CResult_BlindedHopDecodeErrorZ_free(_res_conv);
11308 }
11309
11310 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_ok"))) TS_CResult_NoneNoneZ_ok() {
11311         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
11312         *ret_conv = CResult_NoneNoneZ_ok();
11313         return tag_ptr(ret_conv, true);
11314 }
11315
11316 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_err"))) TS_CResult_NoneNoneZ_err() {
11317         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
11318         *ret_conv = CResult_NoneNoneZ_err();
11319         return tag_ptr(ret_conv, true);
11320 }
11321
11322 jboolean  __attribute__((export_name("TS_CResult_NoneNoneZ_is_ok"))) TS_CResult_NoneNoneZ_is_ok(uint64_t o) {
11323         LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)untag_ptr(o);
11324         jboolean ret_conv = CResult_NoneNoneZ_is_ok(o_conv);
11325         return ret_conv;
11326 }
11327
11328 void  __attribute__((export_name("TS_CResult_NoneNoneZ_free"))) TS_CResult_NoneNoneZ_free(uint64_t _res) {
11329         if (!ptr_is_owned(_res)) return;
11330         void* _res_ptr = untag_ptr(_res);
11331         CHECK_ACCESS(_res_ptr);
11332         LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
11333         FREE(untag_ptr(_res));
11334         CResult_NoneNoneZ_free(_res_conv);
11335 }
11336
11337 static inline uint64_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
11338         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
11339         *ret_conv = CResult_NoneNoneZ_clone(arg);
11340         return tag_ptr(ret_conv, true);
11341 }
11342 int64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_clone_ptr"))) TS_CResult_NoneNoneZ_clone_ptr(uint64_t arg) {
11343         LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)untag_ptr(arg);
11344         int64_t ret_conv = CResult_NoneNoneZ_clone_ptr(arg_conv);
11345         return ret_conv;
11346 }
11347
11348 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_clone"))) TS_CResult_NoneNoneZ_clone(uint64_t orig) {
11349         LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)untag_ptr(orig);
11350         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
11351         *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
11352         return tag_ptr(ret_conv, true);
11353 }
11354
11355 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(uint64_t o) {
11356         LDKCounterpartyCommitmentSecrets o_conv;
11357         o_conv.inner = untag_ptr(o);
11358         o_conv.is_owned = ptr_is_owned(o);
11359         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11360         o_conv = CounterpartyCommitmentSecrets_clone(&o_conv);
11361         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
11362         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o_conv);
11363         return tag_ptr(ret_conv, true);
11364 }
11365
11366 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(uint64_t e) {
11367         LDKDecodeError e_conv;
11368         e_conv.inner = untag_ptr(e);
11369         e_conv.is_owned = ptr_is_owned(e);
11370         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11371         e_conv = DecodeError_clone(&e_conv);
11372         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
11373         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e_conv);
11374         return tag_ptr(ret_conv, true);
11375 }
11376
11377 jboolean  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(uint64_t o) {
11378         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* o_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(o);
11379         jboolean ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o_conv);
11380         return ret_conv;
11381 }
11382
11383 void  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(uint64_t _res) {
11384         if (!ptr_is_owned(_res)) return;
11385         void* _res_ptr = untag_ptr(_res);
11386         CHECK_ACCESS(_res_ptr);
11387         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(_res_ptr);
11388         FREE(untag_ptr(_res));
11389         CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res_conv);
11390 }
11391
11392 static inline uint64_t CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR arg) {
11393         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
11394         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(arg);
11395         return tag_ptr(ret_conv, true);
11396 }
11397 int64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(uint64_t arg) {
11398         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(arg);
11399         int64_t ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(arg_conv);
11400         return ret_conv;
11401 }
11402
11403 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(uint64_t orig) {
11404         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(orig);
11405         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
11406         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig_conv);
11407         return tag_ptr(ret_conv, true);
11408 }
11409
11410 uint64_t  __attribute__((export_name("TS_CResult_SecretKeyErrorZ_ok"))) TS_CResult_SecretKeyErrorZ_ok(int8_tArray o) {
11411         LDKSecretKey o_ref;
11412         CHECK(o->arr_len == 32);
11413         memcpy(o_ref.bytes, o->elems, 32); FREE(o);
11414         LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
11415         *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
11416         return tag_ptr(ret_conv, true);
11417 }
11418
11419 uint64_t  __attribute__((export_name("TS_CResult_SecretKeyErrorZ_err"))) TS_CResult_SecretKeyErrorZ_err(uint32_t e) {
11420         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
11421         LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
11422         *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
11423         return tag_ptr(ret_conv, true);
11424 }
11425
11426 jboolean  __attribute__((export_name("TS_CResult_SecretKeyErrorZ_is_ok"))) TS_CResult_SecretKeyErrorZ_is_ok(uint64_t o) {
11427         LDKCResult_SecretKeyErrorZ* o_conv = (LDKCResult_SecretKeyErrorZ*)untag_ptr(o);
11428         jboolean ret_conv = CResult_SecretKeyErrorZ_is_ok(o_conv);
11429         return ret_conv;
11430 }
11431
11432 void  __attribute__((export_name("TS_CResult_SecretKeyErrorZ_free"))) TS_CResult_SecretKeyErrorZ_free(uint64_t _res) {
11433         if (!ptr_is_owned(_res)) return;
11434         void* _res_ptr = untag_ptr(_res);
11435         CHECK_ACCESS(_res_ptr);
11436         LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(_res_ptr);
11437         FREE(untag_ptr(_res));
11438         CResult_SecretKeyErrorZ_free(_res_conv);
11439 }
11440
11441 static inline uint64_t CResult_SecretKeyErrorZ_clone_ptr(LDKCResult_SecretKeyErrorZ *NONNULL_PTR arg) {
11442         LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
11443         *ret_conv = CResult_SecretKeyErrorZ_clone(arg);
11444         return tag_ptr(ret_conv, true);
11445 }
11446 int64_t  __attribute__((export_name("TS_CResult_SecretKeyErrorZ_clone_ptr"))) TS_CResult_SecretKeyErrorZ_clone_ptr(uint64_t arg) {
11447         LDKCResult_SecretKeyErrorZ* arg_conv = (LDKCResult_SecretKeyErrorZ*)untag_ptr(arg);
11448         int64_t ret_conv = CResult_SecretKeyErrorZ_clone_ptr(arg_conv);
11449         return ret_conv;
11450 }
11451
11452 uint64_t  __attribute__((export_name("TS_CResult_SecretKeyErrorZ_clone"))) TS_CResult_SecretKeyErrorZ_clone(uint64_t orig) {
11453         LDKCResult_SecretKeyErrorZ* orig_conv = (LDKCResult_SecretKeyErrorZ*)untag_ptr(orig);
11454         LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
11455         *ret_conv = CResult_SecretKeyErrorZ_clone(orig_conv);
11456         return tag_ptr(ret_conv, true);
11457 }
11458
11459 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_ok"))) TS_CResult_PublicKeyErrorZ_ok(int8_tArray o) {
11460         LDKPublicKey o_ref;
11461         CHECK(o->arr_len == 33);
11462         memcpy(o_ref.compressed_form, o->elems, 33); FREE(o);
11463         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
11464         *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
11465         return tag_ptr(ret_conv, true);
11466 }
11467
11468 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_err"))) TS_CResult_PublicKeyErrorZ_err(uint32_t e) {
11469         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
11470         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
11471         *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
11472         return tag_ptr(ret_conv, true);
11473 }
11474
11475 jboolean  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_is_ok"))) TS_CResult_PublicKeyErrorZ_is_ok(uint64_t o) {
11476         LDKCResult_PublicKeyErrorZ* o_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(o);
11477         jboolean ret_conv = CResult_PublicKeyErrorZ_is_ok(o_conv);
11478         return ret_conv;
11479 }
11480
11481 void  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_free"))) TS_CResult_PublicKeyErrorZ_free(uint64_t _res) {
11482         if (!ptr_is_owned(_res)) return;
11483         void* _res_ptr = untag_ptr(_res);
11484         CHECK_ACCESS(_res_ptr);
11485         LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(_res_ptr);
11486         FREE(untag_ptr(_res));
11487         CResult_PublicKeyErrorZ_free(_res_conv);
11488 }
11489
11490 static inline uint64_t CResult_PublicKeyErrorZ_clone_ptr(LDKCResult_PublicKeyErrorZ *NONNULL_PTR arg) {
11491         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
11492         *ret_conv = CResult_PublicKeyErrorZ_clone(arg);
11493         return tag_ptr(ret_conv, true);
11494 }
11495 int64_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_clone_ptr"))) TS_CResult_PublicKeyErrorZ_clone_ptr(uint64_t arg) {
11496         LDKCResult_PublicKeyErrorZ* arg_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(arg);
11497         int64_t ret_conv = CResult_PublicKeyErrorZ_clone_ptr(arg_conv);
11498         return ret_conv;
11499 }
11500
11501 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_clone"))) TS_CResult_PublicKeyErrorZ_clone(uint64_t orig) {
11502         LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(orig);
11503         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
11504         *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
11505         return tag_ptr(ret_conv, true);
11506 }
11507
11508 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_ok(uint64_t o) {
11509         LDKTxCreationKeys o_conv;
11510         o_conv.inner = untag_ptr(o);
11511         o_conv.is_owned = ptr_is_owned(o);
11512         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11513         o_conv = TxCreationKeys_clone(&o_conv);
11514         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
11515         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
11516         return tag_ptr(ret_conv, true);
11517 }
11518
11519 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_err"))) TS_CResult_TxCreationKeysDecodeErrorZ_err(uint64_t e) {
11520         LDKDecodeError e_conv;
11521         e_conv.inner = untag_ptr(e);
11522         e_conv.is_owned = ptr_is_owned(e);
11523         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11524         e_conv = DecodeError_clone(&e_conv);
11525         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
11526         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
11527         return tag_ptr(ret_conv, true);
11528 }
11529
11530 jboolean  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_is_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_is_ok(uint64_t o) {
11531         LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(o);
11532         jboolean ret_conv = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
11533         return ret_conv;
11534 }
11535
11536 void  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_free"))) TS_CResult_TxCreationKeysDecodeErrorZ_free(uint64_t _res) {
11537         if (!ptr_is_owned(_res)) return;
11538         void* _res_ptr = untag_ptr(_res);
11539         CHECK_ACCESS(_res_ptr);
11540         LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
11541         FREE(untag_ptr(_res));
11542         CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
11543 }
11544
11545 static inline uint64_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
11546         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
11547         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
11548         return tag_ptr(ret_conv, true);
11549 }
11550 int64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr(uint64_t arg) {
11551         LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(arg);
11552         int64_t ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
11553         return ret_conv;
11554 }
11555
11556 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone(uint64_t orig) {
11557         LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(orig);
11558         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
11559         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
11560         return tag_ptr(ret_conv, true);
11561 }
11562
11563 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_ok(uint64_t o) {
11564         LDKChannelPublicKeys o_conv;
11565         o_conv.inner = untag_ptr(o);
11566         o_conv.is_owned = ptr_is_owned(o);
11567         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11568         o_conv = ChannelPublicKeys_clone(&o_conv);
11569         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
11570         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
11571         return tag_ptr(ret_conv, true);
11572 }
11573
11574 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_err"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_err(uint64_t e) {
11575         LDKDecodeError e_conv;
11576         e_conv.inner = untag_ptr(e);
11577         e_conv.is_owned = ptr_is_owned(e);
11578         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11579         e_conv = DecodeError_clone(&e_conv);
11580         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
11581         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
11582         return tag_ptr(ret_conv, true);
11583 }
11584
11585 jboolean  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok(uint64_t o) {
11586         LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(o);
11587         jboolean ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
11588         return ret_conv;
11589 }
11590
11591 void  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_free"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_free(uint64_t _res) {
11592         if (!ptr_is_owned(_res)) return;
11593         void* _res_ptr = untag_ptr(_res);
11594         CHECK_ACCESS(_res_ptr);
11595         LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
11596         FREE(untag_ptr(_res));
11597         CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
11598 }
11599
11600 static inline uint64_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
11601         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
11602         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
11603         return tag_ptr(ret_conv, true);
11604 }
11605 int64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(uint64_t arg) {
11606         LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(arg);
11607         int64_t ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
11608         return ret_conv;
11609 }
11610
11611 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_clone"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone(uint64_t orig) {
11612         LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(orig);
11613         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
11614         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
11615         return tag_ptr(ret_conv, true);
11616 }
11617
11618 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_ok"))) TS_CResult_TxCreationKeysErrorZ_ok(uint64_t o) {
11619         LDKTxCreationKeys o_conv;
11620         o_conv.inner = untag_ptr(o);
11621         o_conv.is_owned = ptr_is_owned(o);
11622         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11623         o_conv = TxCreationKeys_clone(&o_conv);
11624         LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
11625         *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
11626         return tag_ptr(ret_conv, true);
11627 }
11628
11629 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_err"))) TS_CResult_TxCreationKeysErrorZ_err(uint32_t e) {
11630         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
11631         LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
11632         *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
11633         return tag_ptr(ret_conv, true);
11634 }
11635
11636 jboolean  __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_is_ok"))) TS_CResult_TxCreationKeysErrorZ_is_ok(uint64_t o) {
11637         LDKCResult_TxCreationKeysErrorZ* o_conv = (LDKCResult_TxCreationKeysErrorZ*)untag_ptr(o);
11638         jboolean ret_conv = CResult_TxCreationKeysErrorZ_is_ok(o_conv);
11639         return ret_conv;
11640 }
11641
11642 void  __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_free"))) TS_CResult_TxCreationKeysErrorZ_free(uint64_t _res) {
11643         if (!ptr_is_owned(_res)) return;
11644         void* _res_ptr = untag_ptr(_res);
11645         CHECK_ACCESS(_res_ptr);
11646         LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(_res_ptr);
11647         FREE(untag_ptr(_res));
11648         CResult_TxCreationKeysErrorZ_free(_res_conv);
11649 }
11650
11651 static inline uint64_t CResult_TxCreationKeysErrorZ_clone_ptr(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR arg) {
11652         LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
11653         *ret_conv = CResult_TxCreationKeysErrorZ_clone(arg);
11654         return tag_ptr(ret_conv, true);
11655 }
11656 int64_t  __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_clone_ptr"))) TS_CResult_TxCreationKeysErrorZ_clone_ptr(uint64_t arg) {
11657         LDKCResult_TxCreationKeysErrorZ* arg_conv = (LDKCResult_TxCreationKeysErrorZ*)untag_ptr(arg);
11658         int64_t ret_conv = CResult_TxCreationKeysErrorZ_clone_ptr(arg_conv);
11659         return ret_conv;
11660 }
11661
11662 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_clone"))) TS_CResult_TxCreationKeysErrorZ_clone(uint64_t orig) {
11663         LDKCResult_TxCreationKeysErrorZ* orig_conv = (LDKCResult_TxCreationKeysErrorZ*)untag_ptr(orig);
11664         LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
11665         *ret_conv = CResult_TxCreationKeysErrorZ_clone(orig_conv);
11666         return tag_ptr(ret_conv, true);
11667 }
11668
11669 uint64_t  __attribute__((export_name("TS_COption_u32Z_some"))) TS_COption_u32Z_some(int32_t o) {
11670         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
11671         *ret_copy = COption_u32Z_some(o);
11672         uint64_t ret_ref = tag_ptr(ret_copy, true);
11673         return ret_ref;
11674 }
11675
11676 uint64_t  __attribute__((export_name("TS_COption_u32Z_none"))) TS_COption_u32Z_none() {
11677         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
11678         *ret_copy = COption_u32Z_none();
11679         uint64_t ret_ref = tag_ptr(ret_copy, true);
11680         return ret_ref;
11681 }
11682
11683 void  __attribute__((export_name("TS_COption_u32Z_free"))) TS_COption_u32Z_free(uint64_t _res) {
11684         if (!ptr_is_owned(_res)) return;
11685         void* _res_ptr = untag_ptr(_res);
11686         CHECK_ACCESS(_res_ptr);
11687         LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
11688         FREE(untag_ptr(_res));
11689         COption_u32Z_free(_res_conv);
11690 }
11691
11692 static inline uint64_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
11693         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
11694         *ret_copy = COption_u32Z_clone(arg);
11695         uint64_t ret_ref = tag_ptr(ret_copy, true);
11696         return ret_ref;
11697 }
11698 int64_t  __attribute__((export_name("TS_COption_u32Z_clone_ptr"))) TS_COption_u32Z_clone_ptr(uint64_t arg) {
11699         LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)untag_ptr(arg);
11700         int64_t ret_conv = COption_u32Z_clone_ptr(arg_conv);
11701         return ret_conv;
11702 }
11703
11704 uint64_t  __attribute__((export_name("TS_COption_u32Z_clone"))) TS_COption_u32Z_clone(uint64_t orig) {
11705         LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)untag_ptr(orig);
11706         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
11707         *ret_copy = COption_u32Z_clone(orig_conv);
11708         uint64_t ret_ref = tag_ptr(ret_copy, true);
11709         return ret_ref;
11710 }
11711
11712 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(uint64_t o) {
11713         LDKHTLCOutputInCommitment o_conv;
11714         o_conv.inner = untag_ptr(o);
11715         o_conv.is_owned = ptr_is_owned(o);
11716         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11717         o_conv = HTLCOutputInCommitment_clone(&o_conv);
11718         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
11719         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
11720         return tag_ptr(ret_conv, true);
11721 }
11722
11723 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err(uint64_t e) {
11724         LDKDecodeError e_conv;
11725         e_conv.inner = untag_ptr(e);
11726         e_conv.is_owned = ptr_is_owned(e);
11727         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11728         e_conv = DecodeError_clone(&e_conv);
11729         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
11730         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
11731         return tag_ptr(ret_conv, true);
11732 }
11733
11734 jboolean  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(uint64_t o) {
11735         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(o);
11736         jboolean ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
11737         return ret_conv;
11738 }
11739
11740 void  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free(uint64_t _res) {
11741         if (!ptr_is_owned(_res)) return;
11742         void* _res_ptr = untag_ptr(_res);
11743         CHECK_ACCESS(_res_ptr);
11744         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
11745         FREE(untag_ptr(_res));
11746         CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
11747 }
11748
11749 static inline uint64_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
11750         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
11751         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
11752         return tag_ptr(ret_conv, true);
11753 }
11754 int64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(uint64_t arg) {
11755         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(arg);
11756         int64_t ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
11757         return ret_conv;
11758 }
11759
11760 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(uint64_t orig) {
11761         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(orig);
11762         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
11763         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
11764         return tag_ptr(ret_conv, true);
11765 }
11766
11767 uint32_t  __attribute__((export_name("TS_COption_NoneZ_some"))) TS_COption_NoneZ_some() {
11768         uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_some());
11769         return ret_conv;
11770 }
11771
11772 uint32_t  __attribute__((export_name("TS_COption_NoneZ_none"))) TS_COption_NoneZ_none() {
11773         uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_none());
11774         return ret_conv;
11775 }
11776
11777 void  __attribute__((export_name("TS_COption_NoneZ_free"))) TS_COption_NoneZ_free(uint32_t _res) {
11778         LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_js(_res);
11779         COption_NoneZ_free(_res_conv);
11780 }
11781
11782 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(uint64_t o) {
11783         LDKCounterpartyChannelTransactionParameters o_conv;
11784         o_conv.inner = untag_ptr(o);
11785         o_conv.is_owned = ptr_is_owned(o);
11786         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11787         o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
11788         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
11789         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
11790         return tag_ptr(ret_conv, true);
11791 }
11792
11793 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(uint64_t e) {
11794         LDKDecodeError e_conv;
11795         e_conv.inner = untag_ptr(e);
11796         e_conv.is_owned = ptr_is_owned(e);
11797         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11798         e_conv = DecodeError_clone(&e_conv);
11799         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
11800         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
11801         return tag_ptr(ret_conv, true);
11802 }
11803
11804 jboolean  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(uint64_t o) {
11805         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
11806         jboolean ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
11807         return ret_conv;
11808 }
11809
11810 void  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(uint64_t _res) {
11811         if (!ptr_is_owned(_res)) return;
11812         void* _res_ptr = untag_ptr(_res);
11813         CHECK_ACCESS(_res_ptr);
11814         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
11815         FREE(untag_ptr(_res));
11816         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
11817 }
11818
11819 static inline uint64_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
11820         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
11821         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
11822         return tag_ptr(ret_conv, true);
11823 }
11824 int64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
11825         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
11826         int64_t ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
11827         return ret_conv;
11828 }
11829
11830 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(uint64_t orig) {
11831         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
11832         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
11833         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
11834         return tag_ptr(ret_conv, true);
11835 }
11836
11837 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok(uint64_t o) {
11838         LDKChannelTransactionParameters o_conv;
11839         o_conv.inner = untag_ptr(o);
11840         o_conv.is_owned = ptr_is_owned(o);
11841         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11842         o_conv = ChannelTransactionParameters_clone(&o_conv);
11843         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
11844         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
11845         return tag_ptr(ret_conv, true);
11846 }
11847
11848 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_err"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_err(uint64_t e) {
11849         LDKDecodeError e_conv;
11850         e_conv.inner = untag_ptr(e);
11851         e_conv.is_owned = ptr_is_owned(e);
11852         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11853         e_conv = DecodeError_clone(&e_conv);
11854         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
11855         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
11856         return tag_ptr(ret_conv, true);
11857 }
11858
11859 jboolean  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(uint64_t o) {
11860         LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
11861         jboolean ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
11862         return ret_conv;
11863 }
11864
11865 void  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_free"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_free(uint64_t _res) {
11866         if (!ptr_is_owned(_res)) return;
11867         void* _res_ptr = untag_ptr(_res);
11868         CHECK_ACCESS(_res_ptr);
11869         LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
11870         FREE(untag_ptr(_res));
11871         CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
11872 }
11873
11874 static inline uint64_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
11875         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
11876         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
11877         return tag_ptr(ret_conv, true);
11878 }
11879 int64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
11880         LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
11881         int64_t ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
11882         return ret_conv;
11883 }
11884
11885 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone(uint64_t orig) {
11886         LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
11887         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
11888         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
11889         return tag_ptr(ret_conv, true);
11890 }
11891
11892 void  __attribute__((export_name("TS_CVec_SignatureZ_free"))) TS_CVec_SignatureZ_free(ptrArray _res) {
11893         LDKCVec_SignatureZ _res_constr;
11894         _res_constr.datalen = _res->arr_len;
11895         if (_res_constr.datalen > 0)
11896                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
11897         else
11898                 _res_constr.data = NULL;
11899         int8_tArray* _res_vals = (void*) _res->elems;
11900         for (size_t m = 0; m < _res_constr.datalen; m++) {
11901                 int8_tArray _res_conv_12 = _res_vals[m];
11902                 LDKSignature _res_conv_12_ref;
11903                 CHECK(_res_conv_12->arr_len == 64);
11904                 memcpy(_res_conv_12_ref.compact_form, _res_conv_12->elems, 64); FREE(_res_conv_12);
11905                 _res_constr.data[m] = _res_conv_12_ref;
11906         }
11907         FREE(_res);
11908         CVec_SignatureZ_free(_res_constr);
11909 }
11910
11911 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
11912         LDKHolderCommitmentTransaction o_conv;
11913         o_conv.inner = untag_ptr(o);
11914         o_conv.is_owned = ptr_is_owned(o);
11915         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11916         o_conv = HolderCommitmentTransaction_clone(&o_conv);
11917         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
11918         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
11919         return tag_ptr(ret_conv, true);
11920 }
11921
11922 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err(uint64_t e) {
11923         LDKDecodeError e_conv;
11924         e_conv.inner = untag_ptr(e);
11925         e_conv.is_owned = ptr_is_owned(e);
11926         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11927         e_conv = DecodeError_clone(&e_conv);
11928         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
11929         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
11930         return tag_ptr(ret_conv, true);
11931 }
11932
11933 jboolean  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
11934         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
11935         jboolean ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
11936         return ret_conv;
11937 }
11938
11939 void  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
11940         if (!ptr_is_owned(_res)) return;
11941         void* _res_ptr = untag_ptr(_res);
11942         CHECK_ACCESS(_res_ptr);
11943         LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
11944         FREE(untag_ptr(_res));
11945         CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
11946 }
11947
11948 static inline uint64_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
11949         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
11950         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
11951         return tag_ptr(ret_conv, true);
11952 }
11953 int64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
11954         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
11955         int64_t ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
11956         return ret_conv;
11957 }
11958
11959 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
11960         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
11961         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
11962         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
11963         return tag_ptr(ret_conv, true);
11964 }
11965
11966 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
11967         LDKBuiltCommitmentTransaction o_conv;
11968         o_conv.inner = untag_ptr(o);
11969         o_conv.is_owned = ptr_is_owned(o);
11970         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11971         o_conv = BuiltCommitmentTransaction_clone(&o_conv);
11972         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
11973         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
11974         return tag_ptr(ret_conv, true);
11975 }
11976
11977 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err(uint64_t e) {
11978         LDKDecodeError e_conv;
11979         e_conv.inner = untag_ptr(e);
11980         e_conv.is_owned = ptr_is_owned(e);
11981         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11982         e_conv = DecodeError_clone(&e_conv);
11983         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
11984         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
11985         return tag_ptr(ret_conv, true);
11986 }
11987
11988 jboolean  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
11989         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
11990         jboolean ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
11991         return ret_conv;
11992 }
11993
11994 void  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
11995         if (!ptr_is_owned(_res)) return;
11996         void* _res_ptr = untag_ptr(_res);
11997         CHECK_ACCESS(_res_ptr);
11998         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
11999         FREE(untag_ptr(_res));
12000         CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
12001 }
12002
12003 static inline uint64_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
12004         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
12005         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
12006         return tag_ptr(ret_conv, true);
12007 }
12008 int64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
12009         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
12010         int64_t ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
12011         return ret_conv;
12012 }
12013
12014 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
12015         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
12016         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
12017         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
12018         return tag_ptr(ret_conv, true);
12019 }
12020
12021 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_ok(uint64_t o) {
12022         LDKTrustedClosingTransaction o_conv;
12023         o_conv.inner = untag_ptr(o);
12024         o_conv.is_owned = ptr_is_owned(o);
12025         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12026         // WARNING: we need a move here but no clone is available for LDKTrustedClosingTransaction
12027         
12028         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
12029         *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
12030         return tag_ptr(ret_conv, true);
12031 }
12032
12033 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_err"))) TS_CResult_TrustedClosingTransactionNoneZ_err() {
12034         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
12035         *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
12036         return tag_ptr(ret_conv, true);
12037 }
12038
12039 jboolean  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_is_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_is_ok(uint64_t o) {
12040         LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(o);
12041         jboolean ret_conv = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
12042         return ret_conv;
12043 }
12044
12045 void  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_free"))) TS_CResult_TrustedClosingTransactionNoneZ_free(uint64_t _res) {
12046         if (!ptr_is_owned(_res)) return;
12047         void* _res_ptr = untag_ptr(_res);
12048         CHECK_ACCESS(_res_ptr);
12049         LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
12050         FREE(untag_ptr(_res));
12051         CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
12052 }
12053
12054 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
12055         LDKCommitmentTransaction o_conv;
12056         o_conv.inner = untag_ptr(o);
12057         o_conv.is_owned = ptr_is_owned(o);
12058         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12059         o_conv = CommitmentTransaction_clone(&o_conv);
12060         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
12061         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
12062         return tag_ptr(ret_conv, true);
12063 }
12064
12065 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_err"))) TS_CResult_CommitmentTransactionDecodeErrorZ_err(uint64_t e) {
12066         LDKDecodeError e_conv;
12067         e_conv.inner = untag_ptr(e);
12068         e_conv.is_owned = ptr_is_owned(e);
12069         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12070         e_conv = DecodeError_clone(&e_conv);
12071         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
12072         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
12073         return tag_ptr(ret_conv, true);
12074 }
12075
12076 jboolean  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
12077         LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(o);
12078         jboolean ret_conv = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
12079         return ret_conv;
12080 }
12081
12082 void  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_free"))) TS_CResult_CommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
12083         if (!ptr_is_owned(_res)) return;
12084         void* _res_ptr = untag_ptr(_res);
12085         CHECK_ACCESS(_res_ptr);
12086         LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
12087         FREE(untag_ptr(_res));
12088         CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
12089 }
12090
12091 static inline uint64_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
12092         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
12093         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
12094         return tag_ptr(ret_conv, true);
12095 }
12096 int64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
12097         LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
12098         int64_t ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
12099         return ret_conv;
12100 }
12101
12102 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
12103         LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
12104         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
12105         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
12106         return tag_ptr(ret_conv, true);
12107 }
12108
12109 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_ok(uint64_t o) {
12110         LDKTrustedCommitmentTransaction o_conv;
12111         o_conv.inner = untag_ptr(o);
12112         o_conv.is_owned = ptr_is_owned(o);
12113         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12114         // WARNING: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
12115         
12116         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
12117         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
12118         return tag_ptr(ret_conv, true);
12119 }
12120
12121 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_err"))) TS_CResult_TrustedCommitmentTransactionNoneZ_err() {
12122         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
12123         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
12124         return tag_ptr(ret_conv, true);
12125 }
12126
12127 jboolean  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok(uint64_t o) {
12128         LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(o);
12129         jboolean ret_conv = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
12130         return ret_conv;
12131 }
12132
12133 void  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_free"))) TS_CResult_TrustedCommitmentTransactionNoneZ_free(uint64_t _res) {
12134         if (!ptr_is_owned(_res)) return;
12135         void* _res_ptr = untag_ptr(_res);
12136         CHECK_ACCESS(_res_ptr);
12137         LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
12138         FREE(untag_ptr(_res));
12139         CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
12140 }
12141
12142 uint64_t  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_ok"))) TS_CResult_CVec_SignatureZNoneZ_ok(ptrArray o) {
12143         LDKCVec_SignatureZ o_constr;
12144         o_constr.datalen = o->arr_len;
12145         if (o_constr.datalen > 0)
12146                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
12147         else
12148                 o_constr.data = NULL;
12149         int8_tArray* o_vals = (void*) o->elems;
12150         for (size_t m = 0; m < o_constr.datalen; m++) {
12151                 int8_tArray o_conv_12 = o_vals[m];
12152                 LDKSignature o_conv_12_ref;
12153                 CHECK(o_conv_12->arr_len == 64);
12154                 memcpy(o_conv_12_ref.compact_form, o_conv_12->elems, 64); FREE(o_conv_12);
12155                 o_constr.data[m] = o_conv_12_ref;
12156         }
12157         FREE(o);
12158         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
12159         *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
12160         return tag_ptr(ret_conv, true);
12161 }
12162
12163 uint64_t  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_err"))) TS_CResult_CVec_SignatureZNoneZ_err() {
12164         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
12165         *ret_conv = CResult_CVec_SignatureZNoneZ_err();
12166         return tag_ptr(ret_conv, true);
12167 }
12168
12169 jboolean  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_is_ok"))) TS_CResult_CVec_SignatureZNoneZ_is_ok(uint64_t o) {
12170         LDKCResult_CVec_SignatureZNoneZ* o_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(o);
12171         jboolean ret_conv = CResult_CVec_SignatureZNoneZ_is_ok(o_conv);
12172         return ret_conv;
12173 }
12174
12175 void  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_free"))) TS_CResult_CVec_SignatureZNoneZ_free(uint64_t _res) {
12176         if (!ptr_is_owned(_res)) return;
12177         void* _res_ptr = untag_ptr(_res);
12178         CHECK_ACCESS(_res_ptr);
12179         LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(_res_ptr);
12180         FREE(untag_ptr(_res));
12181         CResult_CVec_SignatureZNoneZ_free(_res_conv);
12182 }
12183
12184 static inline uint64_t CResult_CVec_SignatureZNoneZ_clone_ptr(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR arg) {
12185         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
12186         *ret_conv = CResult_CVec_SignatureZNoneZ_clone(arg);
12187         return tag_ptr(ret_conv, true);
12188 }
12189 int64_t  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_clone_ptr"))) TS_CResult_CVec_SignatureZNoneZ_clone_ptr(uint64_t arg) {
12190         LDKCResult_CVec_SignatureZNoneZ* arg_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(arg);
12191         int64_t ret_conv = CResult_CVec_SignatureZNoneZ_clone_ptr(arg_conv);
12192         return ret_conv;
12193 }
12194
12195 uint64_t  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_clone"))) TS_CResult_CVec_SignatureZNoneZ_clone(uint64_t orig) {
12196         LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(orig);
12197         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
12198         *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
12199         return tag_ptr(ret_conv, true);
12200 }
12201
12202 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_ok(uint64_t o) {
12203         LDKShutdownScript o_conv;
12204         o_conv.inner = untag_ptr(o);
12205         o_conv.is_owned = ptr_is_owned(o);
12206         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12207         o_conv = ShutdownScript_clone(&o_conv);
12208         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
12209         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
12210         return tag_ptr(ret_conv, true);
12211 }
12212
12213 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_err"))) TS_CResult_ShutdownScriptDecodeErrorZ_err(uint64_t e) {
12214         LDKDecodeError e_conv;
12215         e_conv.inner = untag_ptr(e);
12216         e_conv.is_owned = ptr_is_owned(e);
12217         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12218         e_conv = DecodeError_clone(&e_conv);
12219         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
12220         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
12221         return tag_ptr(ret_conv, true);
12222 }
12223
12224 jboolean  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_is_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_is_ok(uint64_t o) {
12225         LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(o);
12226         jboolean ret_conv = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
12227         return ret_conv;
12228 }
12229
12230 void  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_free"))) TS_CResult_ShutdownScriptDecodeErrorZ_free(uint64_t _res) {
12231         if (!ptr_is_owned(_res)) return;
12232         void* _res_ptr = untag_ptr(_res);
12233         CHECK_ACCESS(_res_ptr);
12234         LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
12235         FREE(untag_ptr(_res));
12236         CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
12237 }
12238
12239 static inline uint64_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
12240         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
12241         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
12242         return tag_ptr(ret_conv, true);
12243 }
12244 int64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr(uint64_t arg) {
12245         LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(arg);
12246         int64_t ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
12247         return ret_conv;
12248 }
12249
12250 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_clone"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone(uint64_t orig) {
12251         LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(orig);
12252         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
12253         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
12254         return tag_ptr(ret_conv, true);
12255 }
12256
12257 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok(uint64_t o) {
12258         LDKShutdownScript o_conv;
12259         o_conv.inner = untag_ptr(o);
12260         o_conv.is_owned = ptr_is_owned(o);
12261         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12262         o_conv = ShutdownScript_clone(&o_conv);
12263         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
12264         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
12265         return tag_ptr(ret_conv, true);
12266 }
12267
12268 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err(uint64_t e) {
12269         LDKInvalidShutdownScript e_conv;
12270         e_conv.inner = untag_ptr(e);
12271         e_conv.is_owned = ptr_is_owned(e);
12272         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12273         e_conv = InvalidShutdownScript_clone(&e_conv);
12274         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
12275         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
12276         return tag_ptr(ret_conv, true);
12277 }
12278
12279 jboolean  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(uint64_t o) {
12280         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(o);
12281         jboolean ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
12282         return ret_conv;
12283 }
12284
12285 void  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free(uint64_t _res) {
12286         if (!ptr_is_owned(_res)) return;
12287         void* _res_ptr = untag_ptr(_res);
12288         CHECK_ACCESS(_res_ptr);
12289         LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
12290         FREE(untag_ptr(_res));
12291         CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
12292 }
12293
12294 static inline uint64_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
12295         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
12296         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
12297         return tag_ptr(ret_conv, true);
12298 }
12299 int64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(uint64_t arg) {
12300         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(arg);
12301         int64_t ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
12302         return ret_conv;
12303 }
12304
12305 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone(uint64_t orig) {
12306         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(orig);
12307         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
12308         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
12309         return tag_ptr(ret_conv, true);
12310 }
12311
12312 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_ok"))) TS_CResult_RouteHopDecodeErrorZ_ok(uint64_t o) {
12313         LDKRouteHop o_conv;
12314         o_conv.inner = untag_ptr(o);
12315         o_conv.is_owned = ptr_is_owned(o);
12316         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12317         o_conv = RouteHop_clone(&o_conv);
12318         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
12319         *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
12320         return tag_ptr(ret_conv, true);
12321 }
12322
12323 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_err"))) TS_CResult_RouteHopDecodeErrorZ_err(uint64_t e) {
12324         LDKDecodeError e_conv;
12325         e_conv.inner = untag_ptr(e);
12326         e_conv.is_owned = ptr_is_owned(e);
12327         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12328         e_conv = DecodeError_clone(&e_conv);
12329         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
12330         *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
12331         return tag_ptr(ret_conv, true);
12332 }
12333
12334 jboolean  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_is_ok"))) TS_CResult_RouteHopDecodeErrorZ_is_ok(uint64_t o) {
12335         LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(o);
12336         jboolean ret_conv = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
12337         return ret_conv;
12338 }
12339
12340 void  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_free"))) TS_CResult_RouteHopDecodeErrorZ_free(uint64_t _res) {
12341         if (!ptr_is_owned(_res)) return;
12342         void* _res_ptr = untag_ptr(_res);
12343         CHECK_ACCESS(_res_ptr);
12344         LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
12345         FREE(untag_ptr(_res));
12346         CResult_RouteHopDecodeErrorZ_free(_res_conv);
12347 }
12348
12349 static inline uint64_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
12350         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
12351         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
12352         return tag_ptr(ret_conv, true);
12353 }
12354 int64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHopDecodeErrorZ_clone_ptr(uint64_t arg) {
12355         LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(arg);
12356         int64_t ret_conv = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
12357         return ret_conv;
12358 }
12359
12360 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone"))) TS_CResult_RouteHopDecodeErrorZ_clone(uint64_t orig) {
12361         LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(orig);
12362         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
12363         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
12364         return tag_ptr(ret_conv, true);
12365 }
12366
12367 void  __attribute__((export_name("TS_CVec_RouteHopZ_free"))) TS_CVec_RouteHopZ_free(uint64_tArray _res) {
12368         LDKCVec_RouteHopZ _res_constr;
12369         _res_constr.datalen = _res->arr_len;
12370         if (_res_constr.datalen > 0)
12371                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
12372         else
12373                 _res_constr.data = NULL;
12374         uint64_t* _res_vals = _res->elems;
12375         for (size_t k = 0; k < _res_constr.datalen; k++) {
12376                 uint64_t _res_conv_10 = _res_vals[k];
12377                 LDKRouteHop _res_conv_10_conv;
12378                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
12379                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
12380                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
12381                 _res_constr.data[k] = _res_conv_10_conv;
12382         }
12383         FREE(_res);
12384         CVec_RouteHopZ_free(_res_constr);
12385 }
12386
12387 void  __attribute__((export_name("TS_CVec_CVec_RouteHopZZ_free"))) TS_CVec_CVec_RouteHopZZ_free(ptrArray _res) {
12388         LDKCVec_CVec_RouteHopZZ _res_constr;
12389         _res_constr.datalen = _res->arr_len;
12390         if (_res_constr.datalen > 0)
12391                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
12392         else
12393                 _res_constr.data = NULL;
12394         uint64_tArray* _res_vals = (void*) _res->elems;
12395         for (size_t m = 0; m < _res_constr.datalen; m++) {
12396                 uint64_tArray _res_conv_12 = _res_vals[m];
12397                 LDKCVec_RouteHopZ _res_conv_12_constr;
12398                 _res_conv_12_constr.datalen = _res_conv_12->arr_len;
12399                 if (_res_conv_12_constr.datalen > 0)
12400                         _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
12401                 else
12402                         _res_conv_12_constr.data = NULL;
12403                 uint64_t* _res_conv_12_vals = _res_conv_12->elems;
12404                 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
12405                         uint64_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
12406                         LDKRouteHop _res_conv_12_conv_10_conv;
12407                         _res_conv_12_conv_10_conv.inner = untag_ptr(_res_conv_12_conv_10);
12408                         _res_conv_12_conv_10_conv.is_owned = ptr_is_owned(_res_conv_12_conv_10);
12409                         CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv_10_conv);
12410                         _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
12411                 }
12412                 FREE(_res_conv_12);
12413                 _res_constr.data[m] = _res_conv_12_constr;
12414         }
12415         FREE(_res);
12416         CVec_CVec_RouteHopZZ_free(_res_constr);
12417 }
12418
12419 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_ok"))) TS_CResult_RouteDecodeErrorZ_ok(uint64_t o) {
12420         LDKRoute o_conv;
12421         o_conv.inner = untag_ptr(o);
12422         o_conv.is_owned = ptr_is_owned(o);
12423         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12424         o_conv = Route_clone(&o_conv);
12425         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
12426         *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
12427         return tag_ptr(ret_conv, true);
12428 }
12429
12430 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_err"))) TS_CResult_RouteDecodeErrorZ_err(uint64_t e) {
12431         LDKDecodeError e_conv;
12432         e_conv.inner = untag_ptr(e);
12433         e_conv.is_owned = ptr_is_owned(e);
12434         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12435         e_conv = DecodeError_clone(&e_conv);
12436         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
12437         *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
12438         return tag_ptr(ret_conv, true);
12439 }
12440
12441 jboolean  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_is_ok"))) TS_CResult_RouteDecodeErrorZ_is_ok(uint64_t o) {
12442         LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(o);
12443         jboolean ret_conv = CResult_RouteDecodeErrorZ_is_ok(o_conv);
12444         return ret_conv;
12445 }
12446
12447 void  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_free"))) TS_CResult_RouteDecodeErrorZ_free(uint64_t _res) {
12448         if (!ptr_is_owned(_res)) return;
12449         void* _res_ptr = untag_ptr(_res);
12450         CHECK_ACCESS(_res_ptr);
12451         LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
12452         FREE(untag_ptr(_res));
12453         CResult_RouteDecodeErrorZ_free(_res_conv);
12454 }
12455
12456 static inline uint64_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
12457         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
12458         *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
12459         return tag_ptr(ret_conv, true);
12460 }
12461 int64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone_ptr"))) TS_CResult_RouteDecodeErrorZ_clone_ptr(uint64_t arg) {
12462         LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(arg);
12463         int64_t ret_conv = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
12464         return ret_conv;
12465 }
12466
12467 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone"))) TS_CResult_RouteDecodeErrorZ_clone(uint64_t orig) {
12468         LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(orig);
12469         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
12470         *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
12471         return tag_ptr(ret_conv, true);
12472 }
12473
12474 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_ok"))) TS_CResult_RouteParametersDecodeErrorZ_ok(uint64_t o) {
12475         LDKRouteParameters o_conv;
12476         o_conv.inner = untag_ptr(o);
12477         o_conv.is_owned = ptr_is_owned(o);
12478         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12479         o_conv = RouteParameters_clone(&o_conv);
12480         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
12481         *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
12482         return tag_ptr(ret_conv, true);
12483 }
12484
12485 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_err"))) TS_CResult_RouteParametersDecodeErrorZ_err(uint64_t e) {
12486         LDKDecodeError e_conv;
12487         e_conv.inner = untag_ptr(e);
12488         e_conv.is_owned = ptr_is_owned(e);
12489         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12490         e_conv = DecodeError_clone(&e_conv);
12491         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
12492         *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
12493         return tag_ptr(ret_conv, true);
12494 }
12495
12496 jboolean  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_is_ok"))) TS_CResult_RouteParametersDecodeErrorZ_is_ok(uint64_t o) {
12497         LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(o);
12498         jboolean ret_conv = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
12499         return ret_conv;
12500 }
12501
12502 void  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_free"))) TS_CResult_RouteParametersDecodeErrorZ_free(uint64_t _res) {
12503         if (!ptr_is_owned(_res)) return;
12504         void* _res_ptr = untag_ptr(_res);
12505         CHECK_ACCESS(_res_ptr);
12506         LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
12507         FREE(untag_ptr(_res));
12508         CResult_RouteParametersDecodeErrorZ_free(_res_conv);
12509 }
12510
12511 static inline uint64_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
12512         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
12513         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
12514         return tag_ptr(ret_conv, true);
12515 }
12516 int64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone_ptr"))) TS_CResult_RouteParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
12517         LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(arg);
12518         int64_t ret_conv = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
12519         return ret_conv;
12520 }
12521
12522 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone"))) TS_CResult_RouteParametersDecodeErrorZ_clone(uint64_t orig) {
12523         LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(orig);
12524         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
12525         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
12526         return tag_ptr(ret_conv, true);
12527 }
12528
12529 void  __attribute__((export_name("TS_CVec_RouteHintZ_free"))) TS_CVec_RouteHintZ_free(uint64_tArray _res) {
12530         LDKCVec_RouteHintZ _res_constr;
12531         _res_constr.datalen = _res->arr_len;
12532         if (_res_constr.datalen > 0)
12533                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
12534         else
12535                 _res_constr.data = NULL;
12536         uint64_t* _res_vals = _res->elems;
12537         for (size_t l = 0; l < _res_constr.datalen; l++) {
12538                 uint64_t _res_conv_11 = _res_vals[l];
12539                 LDKRouteHint _res_conv_11_conv;
12540                 _res_conv_11_conv.inner = untag_ptr(_res_conv_11);
12541                 _res_conv_11_conv.is_owned = ptr_is_owned(_res_conv_11);
12542                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
12543                 _res_constr.data[l] = _res_conv_11_conv;
12544         }
12545         FREE(_res);
12546         CVec_RouteHintZ_free(_res_constr);
12547 }
12548
12549 uint64_t  __attribute__((export_name("TS_COption_u64Z_some"))) TS_COption_u64Z_some(int64_t o) {
12550         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
12551         *ret_copy = COption_u64Z_some(o);
12552         uint64_t ret_ref = tag_ptr(ret_copy, true);
12553         return ret_ref;
12554 }
12555
12556 uint64_t  __attribute__((export_name("TS_COption_u64Z_none"))) TS_COption_u64Z_none() {
12557         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
12558         *ret_copy = COption_u64Z_none();
12559         uint64_t ret_ref = tag_ptr(ret_copy, true);
12560         return ret_ref;
12561 }
12562
12563 void  __attribute__((export_name("TS_COption_u64Z_free"))) TS_COption_u64Z_free(uint64_t _res) {
12564         if (!ptr_is_owned(_res)) return;
12565         void* _res_ptr = untag_ptr(_res);
12566         CHECK_ACCESS(_res_ptr);
12567         LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
12568         FREE(untag_ptr(_res));
12569         COption_u64Z_free(_res_conv);
12570 }
12571
12572 static inline uint64_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
12573         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
12574         *ret_copy = COption_u64Z_clone(arg);
12575         uint64_t ret_ref = tag_ptr(ret_copy, true);
12576         return ret_ref;
12577 }
12578 int64_t  __attribute__((export_name("TS_COption_u64Z_clone_ptr"))) TS_COption_u64Z_clone_ptr(uint64_t arg) {
12579         LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)untag_ptr(arg);
12580         int64_t ret_conv = COption_u64Z_clone_ptr(arg_conv);
12581         return ret_conv;
12582 }
12583
12584 uint64_t  __attribute__((export_name("TS_COption_u64Z_clone"))) TS_COption_u64Z_clone(uint64_t orig) {
12585         LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)untag_ptr(orig);
12586         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
12587         *ret_copy = COption_u64Z_clone(orig_conv);
12588         uint64_t ret_ref = tag_ptr(ret_copy, true);
12589         return ret_ref;
12590 }
12591
12592 void  __attribute__((export_name("TS_CVec_u64Z_free"))) TS_CVec_u64Z_free(int64_tArray _res) {
12593         LDKCVec_u64Z _res_constr;
12594         _res_constr.datalen = _res->arr_len;
12595         if (_res_constr.datalen > 0)
12596                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
12597         else
12598                 _res_constr.data = NULL;
12599         int64_t* _res_vals = _res->elems;
12600         for (size_t i = 0; i < _res_constr.datalen; i++) {
12601                 int64_t _res_conv_8 = _res_vals[i];
12602                 _res_constr.data[i] = _res_conv_8;
12603         }
12604         FREE(_res);
12605         CVec_u64Z_free(_res_constr);
12606 }
12607
12608 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_ok(uint64_t o) {
12609         LDKPaymentParameters o_conv;
12610         o_conv.inner = untag_ptr(o);
12611         o_conv.is_owned = ptr_is_owned(o);
12612         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12613         o_conv = PaymentParameters_clone(&o_conv);
12614         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
12615         *ret_conv = CResult_PaymentParametersDecodeErrorZ_ok(o_conv);
12616         return tag_ptr(ret_conv, true);
12617 }
12618
12619 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_err"))) TS_CResult_PaymentParametersDecodeErrorZ_err(uint64_t e) {
12620         LDKDecodeError e_conv;
12621         e_conv.inner = untag_ptr(e);
12622         e_conv.is_owned = ptr_is_owned(e);
12623         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12624         e_conv = DecodeError_clone(&e_conv);
12625         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
12626         *ret_conv = CResult_PaymentParametersDecodeErrorZ_err(e_conv);
12627         return tag_ptr(ret_conv, true);
12628 }
12629
12630 jboolean  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_is_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_is_ok(uint64_t o) {
12631         LDKCResult_PaymentParametersDecodeErrorZ* o_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(o);
12632         jboolean ret_conv = CResult_PaymentParametersDecodeErrorZ_is_ok(o_conv);
12633         return ret_conv;
12634 }
12635
12636 void  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_free"))) TS_CResult_PaymentParametersDecodeErrorZ_free(uint64_t _res) {
12637         if (!ptr_is_owned(_res)) return;
12638         void* _res_ptr = untag_ptr(_res);
12639         CHECK_ACCESS(_res_ptr);
12640         LDKCResult_PaymentParametersDecodeErrorZ _res_conv = *(LDKCResult_PaymentParametersDecodeErrorZ*)(_res_ptr);
12641         FREE(untag_ptr(_res));
12642         CResult_PaymentParametersDecodeErrorZ_free(_res_conv);
12643 }
12644
12645 static inline uint64_t CResult_PaymentParametersDecodeErrorZ_clone_ptr(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR arg) {
12646         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
12647         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(arg);
12648         return tag_ptr(ret_conv, true);
12649 }
12650 int64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
12651         LDKCResult_PaymentParametersDecodeErrorZ* arg_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(arg);
12652         int64_t ret_conv = CResult_PaymentParametersDecodeErrorZ_clone_ptr(arg_conv);
12653         return ret_conv;
12654 }
12655
12656 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_clone"))) TS_CResult_PaymentParametersDecodeErrorZ_clone(uint64_t orig) {
12657         LDKCResult_PaymentParametersDecodeErrorZ* orig_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(orig);
12658         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
12659         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(orig_conv);
12660         return tag_ptr(ret_conv, true);
12661 }
12662
12663 void  __attribute__((export_name("TS_CVec_RouteHintHopZ_free"))) TS_CVec_RouteHintHopZ_free(uint64_tArray _res) {
12664         LDKCVec_RouteHintHopZ _res_constr;
12665         _res_constr.datalen = _res->arr_len;
12666         if (_res_constr.datalen > 0)
12667                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
12668         else
12669                 _res_constr.data = NULL;
12670         uint64_t* _res_vals = _res->elems;
12671         for (size_t o = 0; o < _res_constr.datalen; o++) {
12672                 uint64_t _res_conv_14 = _res_vals[o];
12673                 LDKRouteHintHop _res_conv_14_conv;
12674                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
12675                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
12676                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
12677                 _res_constr.data[o] = _res_conv_14_conv;
12678         }
12679         FREE(_res);
12680         CVec_RouteHintHopZ_free(_res_constr);
12681 }
12682
12683 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_ok"))) TS_CResult_RouteHintDecodeErrorZ_ok(uint64_t o) {
12684         LDKRouteHint o_conv;
12685         o_conv.inner = untag_ptr(o);
12686         o_conv.is_owned = ptr_is_owned(o);
12687         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12688         o_conv = RouteHint_clone(&o_conv);
12689         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
12690         *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
12691         return tag_ptr(ret_conv, true);
12692 }
12693
12694 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_err"))) TS_CResult_RouteHintDecodeErrorZ_err(uint64_t e) {
12695         LDKDecodeError e_conv;
12696         e_conv.inner = untag_ptr(e);
12697         e_conv.is_owned = ptr_is_owned(e);
12698         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12699         e_conv = DecodeError_clone(&e_conv);
12700         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
12701         *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
12702         return tag_ptr(ret_conv, true);
12703 }
12704
12705 jboolean  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_is_ok"))) TS_CResult_RouteHintDecodeErrorZ_is_ok(uint64_t o) {
12706         LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(o);
12707         jboolean ret_conv = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
12708         return ret_conv;
12709 }
12710
12711 void  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_free"))) TS_CResult_RouteHintDecodeErrorZ_free(uint64_t _res) {
12712         if (!ptr_is_owned(_res)) return;
12713         void* _res_ptr = untag_ptr(_res);
12714         CHECK_ACCESS(_res_ptr);
12715         LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
12716         FREE(untag_ptr(_res));
12717         CResult_RouteHintDecodeErrorZ_free(_res_conv);
12718 }
12719
12720 static inline uint64_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
12721         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
12722         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
12723         return tag_ptr(ret_conv, true);
12724 }
12725 int64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHintDecodeErrorZ_clone_ptr(uint64_t arg) {
12726         LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(arg);
12727         int64_t ret_conv = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
12728         return ret_conv;
12729 }
12730
12731 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_clone"))) TS_CResult_RouteHintDecodeErrorZ_clone(uint64_t orig) {
12732         LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(orig);
12733         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
12734         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
12735         return tag_ptr(ret_conv, true);
12736 }
12737
12738 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_ok(uint64_t o) {
12739         LDKRouteHintHop o_conv;
12740         o_conv.inner = untag_ptr(o);
12741         o_conv.is_owned = ptr_is_owned(o);
12742         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12743         o_conv = RouteHintHop_clone(&o_conv);
12744         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
12745         *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
12746         return tag_ptr(ret_conv, true);
12747 }
12748
12749 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_err"))) TS_CResult_RouteHintHopDecodeErrorZ_err(uint64_t e) {
12750         LDKDecodeError e_conv;
12751         e_conv.inner = untag_ptr(e);
12752         e_conv.is_owned = ptr_is_owned(e);
12753         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12754         e_conv = DecodeError_clone(&e_conv);
12755         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
12756         *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
12757         return tag_ptr(ret_conv, true);
12758 }
12759
12760 jboolean  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_is_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_is_ok(uint64_t o) {
12761         LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(o);
12762         jboolean ret_conv = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
12763         return ret_conv;
12764 }
12765
12766 void  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_free"))) TS_CResult_RouteHintHopDecodeErrorZ_free(uint64_t _res) {
12767         if (!ptr_is_owned(_res)) return;
12768         void* _res_ptr = untag_ptr(_res);
12769         CHECK_ACCESS(_res_ptr);
12770         LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
12771         FREE(untag_ptr(_res));
12772         CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
12773 }
12774
12775 static inline uint64_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
12776         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
12777         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
12778         return tag_ptr(ret_conv, true);
12779 }
12780 int64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr(uint64_t arg) {
12781         LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(arg);
12782         int64_t ret_conv = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
12783         return ret_conv;
12784 }
12785
12786 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_clone"))) TS_CResult_RouteHintHopDecodeErrorZ_clone(uint64_t orig) {
12787         LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(orig);
12788         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
12789         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
12790         return tag_ptr(ret_conv, true);
12791 }
12792
12793 void  __attribute__((export_name("TS_CVec_ChannelDetailsZ_free"))) TS_CVec_ChannelDetailsZ_free(uint64_tArray _res) {
12794         LDKCVec_ChannelDetailsZ _res_constr;
12795         _res_constr.datalen = _res->arr_len;
12796         if (_res_constr.datalen > 0)
12797                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
12798         else
12799                 _res_constr.data = NULL;
12800         uint64_t* _res_vals = _res->elems;
12801         for (size_t q = 0; q < _res_constr.datalen; q++) {
12802                 uint64_t _res_conv_16 = _res_vals[q];
12803                 LDKChannelDetails _res_conv_16_conv;
12804                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
12805                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
12806                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
12807                 _res_constr.data[q] = _res_conv_16_conv;
12808         }
12809         FREE(_res);
12810         CVec_ChannelDetailsZ_free(_res_constr);
12811 }
12812
12813 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_ok"))) TS_CResult_RouteLightningErrorZ_ok(uint64_t o) {
12814         LDKRoute o_conv;
12815         o_conv.inner = untag_ptr(o);
12816         o_conv.is_owned = ptr_is_owned(o);
12817         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12818         o_conv = Route_clone(&o_conv);
12819         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
12820         *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
12821         return tag_ptr(ret_conv, true);
12822 }
12823
12824 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_err"))) TS_CResult_RouteLightningErrorZ_err(uint64_t e) {
12825         LDKLightningError e_conv;
12826         e_conv.inner = untag_ptr(e);
12827         e_conv.is_owned = ptr_is_owned(e);
12828         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12829         e_conv = LightningError_clone(&e_conv);
12830         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
12831         *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
12832         return tag_ptr(ret_conv, true);
12833 }
12834
12835 jboolean  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_is_ok"))) TS_CResult_RouteLightningErrorZ_is_ok(uint64_t o) {
12836         LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(o);
12837         jboolean ret_conv = CResult_RouteLightningErrorZ_is_ok(o_conv);
12838         return ret_conv;
12839 }
12840
12841 void  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_free"))) TS_CResult_RouteLightningErrorZ_free(uint64_t _res) {
12842         if (!ptr_is_owned(_res)) return;
12843         void* _res_ptr = untag_ptr(_res);
12844         CHECK_ACCESS(_res_ptr);
12845         LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
12846         FREE(untag_ptr(_res));
12847         CResult_RouteLightningErrorZ_free(_res_conv);
12848 }
12849
12850 static inline uint64_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
12851         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
12852         *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
12853         return tag_ptr(ret_conv, true);
12854 }
12855 int64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone_ptr"))) TS_CResult_RouteLightningErrorZ_clone_ptr(uint64_t arg) {
12856         LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(arg);
12857         int64_t ret_conv = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
12858         return ret_conv;
12859 }
12860
12861 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone"))) TS_CResult_RouteLightningErrorZ_clone(uint64_t orig) {
12862         LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(orig);
12863         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
12864         *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
12865         return tag_ptr(ret_conv, true);
12866 }
12867
12868 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_ok(uint64_t o) {
12869         void* o_ptr = untag_ptr(o);
12870         CHECK_ACCESS(o_ptr);
12871         LDKPaymentPurpose o_conv = *(LDKPaymentPurpose*)(o_ptr);
12872         o_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(o));
12873         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
12874         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_ok(o_conv);
12875         return tag_ptr(ret_conv, true);
12876 }
12877
12878 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_err"))) TS_CResult_PaymentPurposeDecodeErrorZ_err(uint64_t e) {
12879         LDKDecodeError e_conv;
12880         e_conv.inner = untag_ptr(e);
12881         e_conv.is_owned = ptr_is_owned(e);
12882         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12883         e_conv = DecodeError_clone(&e_conv);
12884         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
12885         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_err(e_conv);
12886         return tag_ptr(ret_conv, true);
12887 }
12888
12889 jboolean  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_is_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_is_ok(uint64_t o) {
12890         LDKCResult_PaymentPurposeDecodeErrorZ* o_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(o);
12891         jboolean ret_conv = CResult_PaymentPurposeDecodeErrorZ_is_ok(o_conv);
12892         return ret_conv;
12893 }
12894
12895 void  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_free"))) TS_CResult_PaymentPurposeDecodeErrorZ_free(uint64_t _res) {
12896         if (!ptr_is_owned(_res)) return;
12897         void* _res_ptr = untag_ptr(_res);
12898         CHECK_ACCESS(_res_ptr);
12899         LDKCResult_PaymentPurposeDecodeErrorZ _res_conv = *(LDKCResult_PaymentPurposeDecodeErrorZ*)(_res_ptr);
12900         FREE(untag_ptr(_res));
12901         CResult_PaymentPurposeDecodeErrorZ_free(_res_conv);
12902 }
12903
12904 static inline uint64_t CResult_PaymentPurposeDecodeErrorZ_clone_ptr(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR arg) {
12905         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
12906         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(arg);
12907         return tag_ptr(ret_conv, true);
12908 }
12909 int64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentPurposeDecodeErrorZ_clone_ptr(uint64_t arg) {
12910         LDKCResult_PaymentPurposeDecodeErrorZ* arg_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(arg);
12911         int64_t ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone_ptr(arg_conv);
12912         return ret_conv;
12913 }
12914
12915 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_clone"))) TS_CResult_PaymentPurposeDecodeErrorZ_clone(uint64_t orig) {
12916         LDKCResult_PaymentPurposeDecodeErrorZ* orig_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(orig);
12917         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
12918         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(orig_conv);
12919         return tag_ptr(ret_conv, true);
12920 }
12921
12922 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_some"))) TS_COption_ClosureReasonZ_some(uint64_t o) {
12923         void* o_ptr = untag_ptr(o);
12924         CHECK_ACCESS(o_ptr);
12925         LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
12926         o_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(o));
12927         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
12928         *ret_copy = COption_ClosureReasonZ_some(o_conv);
12929         uint64_t ret_ref = tag_ptr(ret_copy, true);
12930         return ret_ref;
12931 }
12932
12933 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_none"))) TS_COption_ClosureReasonZ_none() {
12934         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
12935         *ret_copy = COption_ClosureReasonZ_none();
12936         uint64_t ret_ref = tag_ptr(ret_copy, true);
12937         return ret_ref;
12938 }
12939
12940 void  __attribute__((export_name("TS_COption_ClosureReasonZ_free"))) TS_COption_ClosureReasonZ_free(uint64_t _res) {
12941         if (!ptr_is_owned(_res)) return;
12942         void* _res_ptr = untag_ptr(_res);
12943         CHECK_ACCESS(_res_ptr);
12944         LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
12945         FREE(untag_ptr(_res));
12946         COption_ClosureReasonZ_free(_res_conv);
12947 }
12948
12949 static inline uint64_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
12950         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
12951         *ret_copy = COption_ClosureReasonZ_clone(arg);
12952         uint64_t ret_ref = tag_ptr(ret_copy, true);
12953         return ret_ref;
12954 }
12955 int64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_clone_ptr"))) TS_COption_ClosureReasonZ_clone_ptr(uint64_t arg) {
12956         LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(arg);
12957         int64_t ret_conv = COption_ClosureReasonZ_clone_ptr(arg_conv);
12958         return ret_conv;
12959 }
12960
12961 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_clone"))) TS_COption_ClosureReasonZ_clone(uint64_t orig) {
12962         LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(orig);
12963         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
12964         *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
12965         uint64_t ret_ref = tag_ptr(ret_copy, true);
12966         return ret_ref;
12967 }
12968
12969 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok(uint64_t o) {
12970         void* o_ptr = untag_ptr(o);
12971         CHECK_ACCESS(o_ptr);
12972         LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
12973         o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)untag_ptr(o));
12974         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
12975         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
12976         return tag_ptr(ret_conv, true);
12977 }
12978
12979 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_err"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_err(uint64_t e) {
12980         LDKDecodeError e_conv;
12981         e_conv.inner = untag_ptr(e);
12982         e_conv.is_owned = ptr_is_owned(e);
12983         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12984         e_conv = DecodeError_clone(&e_conv);
12985         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
12986         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
12987         return tag_ptr(ret_conv, true);
12988 }
12989
12990 jboolean  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(uint64_t o) {
12991         LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(o);
12992         jboolean ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
12993         return ret_conv;
12994 }
12995
12996 void  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_free"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_free(uint64_t _res) {
12997         if (!ptr_is_owned(_res)) return;
12998         void* _res_ptr = untag_ptr(_res);
12999         CHECK_ACCESS(_res_ptr);
13000         LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
13001         FREE(untag_ptr(_res));
13002         CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
13003 }
13004
13005 static inline uint64_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
13006         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
13007         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
13008         return tag_ptr(ret_conv, true);
13009 }
13010 int64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(uint64_t arg) {
13011         LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(arg);
13012         int64_t ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
13013         return ret_conv;
13014 }
13015
13016 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone(uint64_t orig) {
13017         LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(orig);
13018         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
13019         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
13020         return tag_ptr(ret_conv, true);
13021 }
13022
13023 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_some"))) TS_COption_HTLCDestinationZ_some(uint64_t o) {
13024         void* o_ptr = untag_ptr(o);
13025         CHECK_ACCESS(o_ptr);
13026         LDKHTLCDestination o_conv = *(LDKHTLCDestination*)(o_ptr);
13027         o_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(o));
13028         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
13029         *ret_copy = COption_HTLCDestinationZ_some(o_conv);
13030         uint64_t ret_ref = tag_ptr(ret_copy, true);
13031         return ret_ref;
13032 }
13033
13034 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_none"))) TS_COption_HTLCDestinationZ_none() {
13035         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
13036         *ret_copy = COption_HTLCDestinationZ_none();
13037         uint64_t ret_ref = tag_ptr(ret_copy, true);
13038         return ret_ref;
13039 }
13040
13041 void  __attribute__((export_name("TS_COption_HTLCDestinationZ_free"))) TS_COption_HTLCDestinationZ_free(uint64_t _res) {
13042         if (!ptr_is_owned(_res)) return;
13043         void* _res_ptr = untag_ptr(_res);
13044         CHECK_ACCESS(_res_ptr);
13045         LDKCOption_HTLCDestinationZ _res_conv = *(LDKCOption_HTLCDestinationZ*)(_res_ptr);
13046         FREE(untag_ptr(_res));
13047         COption_HTLCDestinationZ_free(_res_conv);
13048 }
13049
13050 static inline uint64_t COption_HTLCDestinationZ_clone_ptr(LDKCOption_HTLCDestinationZ *NONNULL_PTR arg) {
13051         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
13052         *ret_copy = COption_HTLCDestinationZ_clone(arg);
13053         uint64_t ret_ref = tag_ptr(ret_copy, true);
13054         return ret_ref;
13055 }
13056 int64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_clone_ptr"))) TS_COption_HTLCDestinationZ_clone_ptr(uint64_t arg) {
13057         LDKCOption_HTLCDestinationZ* arg_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(arg);
13058         int64_t ret_conv = COption_HTLCDestinationZ_clone_ptr(arg_conv);
13059         return ret_conv;
13060 }
13061
13062 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_clone"))) TS_COption_HTLCDestinationZ_clone(uint64_t orig) {
13063         LDKCOption_HTLCDestinationZ* orig_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(orig);
13064         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
13065         *ret_copy = COption_HTLCDestinationZ_clone(orig_conv);
13066         uint64_t ret_ref = tag_ptr(ret_copy, true);
13067         return ret_ref;
13068 }
13069
13070 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_ok(uint64_t o) {
13071         void* o_ptr = untag_ptr(o);
13072         CHECK_ACCESS(o_ptr);
13073         LDKCOption_HTLCDestinationZ o_conv = *(LDKCOption_HTLCDestinationZ*)(o_ptr);
13074         o_conv = COption_HTLCDestinationZ_clone((LDKCOption_HTLCDestinationZ*)untag_ptr(o));
13075         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
13076         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o_conv);
13077         return tag_ptr(ret_conv, true);
13078 }
13079
13080 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_err"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_err(uint64_t e) {
13081         LDKDecodeError e_conv;
13082         e_conv.inner = untag_ptr(e);
13083         e_conv.is_owned = ptr_is_owned(e);
13084         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13085         e_conv = DecodeError_clone(&e_conv);
13086         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
13087         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_err(e_conv);
13088         return tag_ptr(ret_conv, true);
13089 }
13090
13091 jboolean  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(uint64_t o) {
13092         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* o_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(o);
13093         jboolean ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o_conv);
13094         return ret_conv;
13095 }
13096
13097 void  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_free"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_free(uint64_t _res) {
13098         if (!ptr_is_owned(_res)) return;
13099         void* _res_ptr = untag_ptr(_res);
13100         CHECK_ACCESS(_res_ptr);
13101         LDKCResult_COption_HTLCDestinationZDecodeErrorZ _res_conv = *(LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(_res_ptr);
13102         FREE(untag_ptr(_res));
13103         CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res_conv);
13104 }
13105
13106 static inline uint64_t CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR arg) {
13107         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
13108         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(arg);
13109         return tag_ptr(ret_conv, true);
13110 }
13111 int64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(uint64_t arg) {
13112         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* arg_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(arg);
13113         int64_t ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(arg_conv);
13114         return ret_conv;
13115 }
13116
13117 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone(uint64_t orig) {
13118         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* orig_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(orig);
13119         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
13120         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig_conv);
13121         return tag_ptr(ret_conv, true);
13122 }
13123
13124 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_some"))) TS_COption_NetworkUpdateZ_some(uint64_t o) {
13125         void* o_ptr = untag_ptr(o);
13126         CHECK_ACCESS(o_ptr);
13127         LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
13128         o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)untag_ptr(o));
13129         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
13130         *ret_copy = COption_NetworkUpdateZ_some(o_conv);
13131         uint64_t ret_ref = tag_ptr(ret_copy, true);
13132         return ret_ref;
13133 }
13134
13135 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_none"))) TS_COption_NetworkUpdateZ_none() {
13136         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
13137         *ret_copy = COption_NetworkUpdateZ_none();
13138         uint64_t ret_ref = tag_ptr(ret_copy, true);
13139         return ret_ref;
13140 }
13141
13142 void  __attribute__((export_name("TS_COption_NetworkUpdateZ_free"))) TS_COption_NetworkUpdateZ_free(uint64_t _res) {
13143         if (!ptr_is_owned(_res)) return;
13144         void* _res_ptr = untag_ptr(_res);
13145         CHECK_ACCESS(_res_ptr);
13146         LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
13147         FREE(untag_ptr(_res));
13148         COption_NetworkUpdateZ_free(_res_conv);
13149 }
13150
13151 static inline uint64_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
13152         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
13153         *ret_copy = COption_NetworkUpdateZ_clone(arg);
13154         uint64_t ret_ref = tag_ptr(ret_copy, true);
13155         return ret_ref;
13156 }
13157 int64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_clone_ptr"))) TS_COption_NetworkUpdateZ_clone_ptr(uint64_t arg) {
13158         LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(arg);
13159         int64_t ret_conv = COption_NetworkUpdateZ_clone_ptr(arg_conv);
13160         return ret_conv;
13161 }
13162
13163 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_clone"))) TS_COption_NetworkUpdateZ_clone(uint64_t orig) {
13164         LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(orig);
13165         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
13166         *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
13167         uint64_t ret_ref = tag_ptr(ret_copy, true);
13168         return ret_ref;
13169 }
13170
13171 void  __attribute__((export_name("TS_CVec_SpendableOutputDescriptorZ_free"))) TS_CVec_SpendableOutputDescriptorZ_free(uint64_tArray _res) {
13172         LDKCVec_SpendableOutputDescriptorZ _res_constr;
13173         _res_constr.datalen = _res->arr_len;
13174         if (_res_constr.datalen > 0)
13175                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
13176         else
13177                 _res_constr.data = NULL;
13178         uint64_t* _res_vals = _res->elems;
13179         for (size_t b = 0; b < _res_constr.datalen; b++) {
13180                 uint64_t _res_conv_27 = _res_vals[b];
13181                 void* _res_conv_27_ptr = untag_ptr(_res_conv_27);
13182                 CHECK_ACCESS(_res_conv_27_ptr);
13183                 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
13184                 FREE(untag_ptr(_res_conv_27));
13185                 _res_constr.data[b] = _res_conv_27_conv;
13186         }
13187         FREE(_res);
13188         CVec_SpendableOutputDescriptorZ_free(_res_constr);
13189 }
13190
13191 uint64_t  __attribute__((export_name("TS_COption_EventZ_some"))) TS_COption_EventZ_some(uint64_t o) {
13192         void* o_ptr = untag_ptr(o);
13193         CHECK_ACCESS(o_ptr);
13194         LDKEvent o_conv = *(LDKEvent*)(o_ptr);
13195         o_conv = Event_clone((LDKEvent*)untag_ptr(o));
13196         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
13197         *ret_copy = COption_EventZ_some(o_conv);
13198         uint64_t ret_ref = tag_ptr(ret_copy, true);
13199         return ret_ref;
13200 }
13201
13202 uint64_t  __attribute__((export_name("TS_COption_EventZ_none"))) TS_COption_EventZ_none() {
13203         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
13204         *ret_copy = COption_EventZ_none();
13205         uint64_t ret_ref = tag_ptr(ret_copy, true);
13206         return ret_ref;
13207 }
13208
13209 void  __attribute__((export_name("TS_COption_EventZ_free"))) TS_COption_EventZ_free(uint64_t _res) {
13210         if (!ptr_is_owned(_res)) return;
13211         void* _res_ptr = untag_ptr(_res);
13212         CHECK_ACCESS(_res_ptr);
13213         LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
13214         FREE(untag_ptr(_res));
13215         COption_EventZ_free(_res_conv);
13216 }
13217
13218 static inline uint64_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
13219         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
13220         *ret_copy = COption_EventZ_clone(arg);
13221         uint64_t ret_ref = tag_ptr(ret_copy, true);
13222         return ret_ref;
13223 }
13224 int64_t  __attribute__((export_name("TS_COption_EventZ_clone_ptr"))) TS_COption_EventZ_clone_ptr(uint64_t arg) {
13225         LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)untag_ptr(arg);
13226         int64_t ret_conv = COption_EventZ_clone_ptr(arg_conv);
13227         return ret_conv;
13228 }
13229
13230 uint64_t  __attribute__((export_name("TS_COption_EventZ_clone"))) TS_COption_EventZ_clone(uint64_t orig) {
13231         LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)untag_ptr(orig);
13232         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
13233         *ret_copy = COption_EventZ_clone(orig_conv);
13234         uint64_t ret_ref = tag_ptr(ret_copy, true);
13235         return ret_ref;
13236 }
13237
13238 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_ok"))) TS_CResult_COption_EventZDecodeErrorZ_ok(uint64_t o) {
13239         void* o_ptr = untag_ptr(o);
13240         CHECK_ACCESS(o_ptr);
13241         LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
13242         o_conv = COption_EventZ_clone((LDKCOption_EventZ*)untag_ptr(o));
13243         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
13244         *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
13245         return tag_ptr(ret_conv, true);
13246 }
13247
13248 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_err"))) TS_CResult_COption_EventZDecodeErrorZ_err(uint64_t e) {
13249         LDKDecodeError e_conv;
13250         e_conv.inner = untag_ptr(e);
13251         e_conv.is_owned = ptr_is_owned(e);
13252         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13253         e_conv = DecodeError_clone(&e_conv);
13254         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
13255         *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
13256         return tag_ptr(ret_conv, true);
13257 }
13258
13259 jboolean  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_is_ok"))) TS_CResult_COption_EventZDecodeErrorZ_is_ok(uint64_t o) {
13260         LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(o);
13261         jboolean ret_conv = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
13262         return ret_conv;
13263 }
13264
13265 void  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_free"))) TS_CResult_COption_EventZDecodeErrorZ_free(uint64_t _res) {
13266         if (!ptr_is_owned(_res)) return;
13267         void* _res_ptr = untag_ptr(_res);
13268         CHECK_ACCESS(_res_ptr);
13269         LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
13270         FREE(untag_ptr(_res));
13271         CResult_COption_EventZDecodeErrorZ_free(_res_conv);
13272 }
13273
13274 static inline uint64_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
13275         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
13276         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
13277         return tag_ptr(ret_conv, true);
13278 }
13279 int64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_EventZDecodeErrorZ_clone_ptr(uint64_t arg) {
13280         LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(arg);
13281         int64_t ret_conv = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
13282         return ret_conv;
13283 }
13284
13285 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_clone"))) TS_CResult_COption_EventZDecodeErrorZ_clone(uint64_t orig) {
13286         LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(orig);
13287         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
13288         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
13289         return tag_ptr(ret_conv, true);
13290 }
13291
13292 void  __attribute__((export_name("TS_CVec_MessageSendEventZ_free"))) TS_CVec_MessageSendEventZ_free(uint64_tArray _res) {
13293         LDKCVec_MessageSendEventZ _res_constr;
13294         _res_constr.datalen = _res->arr_len;
13295         if (_res_constr.datalen > 0)
13296                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
13297         else
13298                 _res_constr.data = NULL;
13299         uint64_t* _res_vals = _res->elems;
13300         for (size_t s = 0; s < _res_constr.datalen; s++) {
13301                 uint64_t _res_conv_18 = _res_vals[s];
13302                 void* _res_conv_18_ptr = untag_ptr(_res_conv_18);
13303                 CHECK_ACCESS(_res_conv_18_ptr);
13304                 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
13305                 FREE(untag_ptr(_res_conv_18));
13306                 _res_constr.data[s] = _res_conv_18_conv;
13307         }
13308         FREE(_res);
13309         CVec_MessageSendEventZ_free(_res_constr);
13310 }
13311
13312 uint64_t  __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_ok"))) TS_CResult_TxOutAccessErrorZ_ok(uint64_t o) {
13313         void* o_ptr = untag_ptr(o);
13314         CHECK_ACCESS(o_ptr);
13315         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
13316         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
13317         LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
13318         *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
13319         return tag_ptr(ret_conv, true);
13320 }
13321
13322 uint64_t  __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_err"))) TS_CResult_TxOutAccessErrorZ_err(uint32_t e) {
13323         LDKAccessError e_conv = LDKAccessError_from_js(e);
13324         LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
13325         *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
13326         return tag_ptr(ret_conv, true);
13327 }
13328
13329 jboolean  __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_is_ok"))) TS_CResult_TxOutAccessErrorZ_is_ok(uint64_t o) {
13330         LDKCResult_TxOutAccessErrorZ* o_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(o);
13331         jboolean ret_conv = CResult_TxOutAccessErrorZ_is_ok(o_conv);
13332         return ret_conv;
13333 }
13334
13335 void  __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_free"))) TS_CResult_TxOutAccessErrorZ_free(uint64_t _res) {
13336         if (!ptr_is_owned(_res)) return;
13337         void* _res_ptr = untag_ptr(_res);
13338         CHECK_ACCESS(_res_ptr);
13339         LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(_res_ptr);
13340         FREE(untag_ptr(_res));
13341         CResult_TxOutAccessErrorZ_free(_res_conv);
13342 }
13343
13344 static inline uint64_t CResult_TxOutAccessErrorZ_clone_ptr(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR arg) {
13345         LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
13346         *ret_conv = CResult_TxOutAccessErrorZ_clone(arg);
13347         return tag_ptr(ret_conv, true);
13348 }
13349 int64_t  __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_clone_ptr"))) TS_CResult_TxOutAccessErrorZ_clone_ptr(uint64_t arg) {
13350         LDKCResult_TxOutAccessErrorZ* arg_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(arg);
13351         int64_t ret_conv = CResult_TxOutAccessErrorZ_clone_ptr(arg_conv);
13352         return ret_conv;
13353 }
13354
13355 uint64_t  __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_clone"))) TS_CResult_TxOutAccessErrorZ_clone(uint64_t orig) {
13356         LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(orig);
13357         LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
13358         *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
13359         return tag_ptr(ret_conv, true);
13360 }
13361
13362 static inline uint64_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
13363         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
13364         *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
13365         return tag_ptr(ret_conv, true);
13366 }
13367 int64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_clone_ptr"))) TS_C2Tuple_usizeTransactionZ_clone_ptr(uint64_t arg) {
13368         LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(arg);
13369         int64_t ret_conv = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
13370         return ret_conv;
13371 }
13372
13373 uint64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_clone"))) TS_C2Tuple_usizeTransactionZ_clone(uint64_t orig) {
13374         LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(orig);
13375         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
13376         *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
13377         return tag_ptr(ret_conv, true);
13378 }
13379
13380 uint64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_new"))) TS_C2Tuple_usizeTransactionZ_new(uint32_t a, int8_tArray b) {
13381         LDKTransaction b_ref;
13382         b_ref.datalen = b->arr_len;
13383         b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
13384         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
13385         b_ref.data_is_owned = true;
13386         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
13387         *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
13388         return tag_ptr(ret_conv, true);
13389 }
13390
13391 void  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_free"))) TS_C2Tuple_usizeTransactionZ_free(uint64_t _res) {
13392         if (!ptr_is_owned(_res)) return;
13393         void* _res_ptr = untag_ptr(_res);
13394         CHECK_ACCESS(_res_ptr);
13395         LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
13396         FREE(untag_ptr(_res));
13397         C2Tuple_usizeTransactionZ_free(_res_conv);
13398 }
13399
13400 void  __attribute__((export_name("TS_CVec_C2Tuple_usizeTransactionZZ_free"))) TS_CVec_C2Tuple_usizeTransactionZZ_free(uint64_tArray _res) {
13401         LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
13402         _res_constr.datalen = _res->arr_len;
13403         if (_res_constr.datalen > 0)
13404                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
13405         else
13406                 _res_constr.data = NULL;
13407         uint64_t* _res_vals = _res->elems;
13408         for (size_t c = 0; c < _res_constr.datalen; c++) {
13409                 uint64_t _res_conv_28 = _res_vals[c];
13410                 void* _res_conv_28_ptr = untag_ptr(_res_conv_28);
13411                 CHECK_ACCESS(_res_conv_28_ptr);
13412                 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
13413                 FREE(untag_ptr(_res_conv_28));
13414                 _res_constr.data[c] = _res_conv_28_conv;
13415         }
13416         FREE(_res);
13417         CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
13418 }
13419
13420 void  __attribute__((export_name("TS_CVec_TxidZ_free"))) TS_CVec_TxidZ_free(ptrArray _res) {
13421         LDKCVec_TxidZ _res_constr;
13422         _res_constr.datalen = _res->arr_len;
13423         if (_res_constr.datalen > 0)
13424                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
13425         else
13426                 _res_constr.data = NULL;
13427         int8_tArray* _res_vals = (void*) _res->elems;
13428         for (size_t m = 0; m < _res_constr.datalen; m++) {
13429                 int8_tArray _res_conv_12 = _res_vals[m];
13430                 LDKThirtyTwoBytes _res_conv_12_ref;
13431                 CHECK(_res_conv_12->arr_len == 32);
13432                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32); FREE(_res_conv_12);
13433                 _res_constr.data[m] = _res_conv_12_ref;
13434         }
13435         FREE(_res);
13436         CVec_TxidZ_free(_res_constr);
13437 }
13438
13439 uint64_t  __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_ok"))) TS_CResult_NoneChannelMonitorUpdateErrZ_ok() {
13440         LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
13441         *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
13442         return tag_ptr(ret_conv, true);
13443 }
13444
13445 uint64_t  __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_err"))) TS_CResult_NoneChannelMonitorUpdateErrZ_err(uint32_t e) {
13446         LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_js(e);
13447         LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
13448         *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
13449         return tag_ptr(ret_conv, true);
13450 }
13451
13452 jboolean  __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_is_ok"))) TS_CResult_NoneChannelMonitorUpdateErrZ_is_ok(uint64_t o) {
13453         LDKCResult_NoneChannelMonitorUpdateErrZ* o_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)untag_ptr(o);
13454         jboolean ret_conv = CResult_NoneChannelMonitorUpdateErrZ_is_ok(o_conv);
13455         return ret_conv;
13456 }
13457
13458 void  __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_free"))) TS_CResult_NoneChannelMonitorUpdateErrZ_free(uint64_t _res) {
13459         if (!ptr_is_owned(_res)) return;
13460         void* _res_ptr = untag_ptr(_res);
13461         CHECK_ACCESS(_res_ptr);
13462         LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(_res_ptr);
13463         FREE(untag_ptr(_res));
13464         CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
13465 }
13466
13467 static inline uint64_t CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR arg) {
13468         LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
13469         *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(arg);
13470         return tag_ptr(ret_conv, true);
13471 }
13472 int64_t  __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_clone_ptr"))) TS_CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(uint64_t arg) {
13473         LDKCResult_NoneChannelMonitorUpdateErrZ* arg_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)untag_ptr(arg);
13474         int64_t ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(arg_conv);
13475         return ret_conv;
13476 }
13477
13478 uint64_t  __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_clone"))) TS_CResult_NoneChannelMonitorUpdateErrZ_clone(uint64_t orig) {
13479         LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)untag_ptr(orig);
13480         LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
13481         *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
13482         return tag_ptr(ret_conv, true);
13483 }
13484
13485 void  __attribute__((export_name("TS_CVec_MonitorEventZ_free"))) TS_CVec_MonitorEventZ_free(uint64_tArray _res) {
13486         LDKCVec_MonitorEventZ _res_constr;
13487         _res_constr.datalen = _res->arr_len;
13488         if (_res_constr.datalen > 0)
13489                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
13490         else
13491                 _res_constr.data = NULL;
13492         uint64_t* _res_vals = _res->elems;
13493         for (size_t o = 0; o < _res_constr.datalen; o++) {
13494                 uint64_t _res_conv_14 = _res_vals[o];
13495                 void* _res_conv_14_ptr = untag_ptr(_res_conv_14);
13496                 CHECK_ACCESS(_res_conv_14_ptr);
13497                 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
13498                 FREE(untag_ptr(_res_conv_14));
13499                 _res_constr.data[o] = _res_conv_14_conv;
13500         }
13501         FREE(_res);
13502         CVec_MonitorEventZ_free(_res_constr);
13503 }
13504
13505 static inline uint64_t C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR arg) {
13506         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
13507         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(arg);
13508         return tag_ptr(ret_conv, true);
13509 }
13510 int64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(uint64_t arg) {
13511         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* arg_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(arg);
13512         int64_t ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(arg_conv);
13513         return ret_conv;
13514 }
13515
13516 uint64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(uint64_t orig) {
13517         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* orig_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(orig);
13518         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
13519         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(orig_conv);
13520         return tag_ptr(ret_conv, true);
13521 }
13522
13523 uint64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(uint64_t a, uint64_tArray b, int8_tArray c) {
13524         LDKOutPoint a_conv;
13525         a_conv.inner = untag_ptr(a);
13526         a_conv.is_owned = ptr_is_owned(a);
13527         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
13528         a_conv = OutPoint_clone(&a_conv);
13529         LDKCVec_MonitorEventZ b_constr;
13530         b_constr.datalen = b->arr_len;
13531         if (b_constr.datalen > 0)
13532                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
13533         else
13534                 b_constr.data = NULL;
13535         uint64_t* b_vals = b->elems;
13536         for (size_t o = 0; o < b_constr.datalen; o++) {
13537                 uint64_t b_conv_14 = b_vals[o];
13538                 void* b_conv_14_ptr = untag_ptr(b_conv_14);
13539                 CHECK_ACCESS(b_conv_14_ptr);
13540                 LDKMonitorEvent b_conv_14_conv = *(LDKMonitorEvent*)(b_conv_14_ptr);
13541                 b_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(b_conv_14));
13542                 b_constr.data[o] = b_conv_14_conv;
13543         }
13544         FREE(b);
13545         LDKPublicKey c_ref;
13546         CHECK(c->arr_len == 33);
13547         memcpy(c_ref.compressed_form, c->elems, 33); FREE(c);
13548         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
13549         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(a_conv, b_constr, c_ref);
13550         return tag_ptr(ret_conv, true);
13551 }
13552
13553 void  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(uint64_t _res) {
13554         if (!ptr_is_owned(_res)) return;
13555         void* _res_ptr = untag_ptr(_res);
13556         CHECK_ACCESS(_res_ptr);
13557         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_ptr);
13558         FREE(untag_ptr(_res));
13559         C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(_res_conv);
13560 }
13561
13562 void  __attribute__((export_name("TS_CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free"))) TS_CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(uint64_tArray _res) {
13563         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ _res_constr;
13564         _res_constr.datalen = _res->arr_len;
13565         if (_res_constr.datalen > 0)
13566                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
13567         else
13568                 _res_constr.data = NULL;
13569         uint64_t* _res_vals = _res->elems;
13570         for (size_t x = 0; x < _res_constr.datalen; x++) {
13571                 uint64_t _res_conv_49 = _res_vals[x];
13572                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
13573                 CHECK_ACCESS(_res_conv_49_ptr);
13574                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_conv_49_ptr);
13575                 FREE(untag_ptr(_res_conv_49));
13576                 _res_constr.data[x] = _res_conv_49_conv;
13577         }
13578         FREE(_res);
13579         CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(_res_constr);
13580 }
13581
13582 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_ok(uint64_t o) {
13583         LDKFixedPenaltyScorer o_conv;
13584         o_conv.inner = untag_ptr(o);
13585         o_conv.is_owned = ptr_is_owned(o);
13586         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13587         o_conv = FixedPenaltyScorer_clone(&o_conv);
13588         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
13589         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_ok(o_conv);
13590         return tag_ptr(ret_conv, true);
13591 }
13592
13593 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_err"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_err(uint64_t e) {
13594         LDKDecodeError e_conv;
13595         e_conv.inner = untag_ptr(e);
13596         e_conv.is_owned = ptr_is_owned(e);
13597         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13598         e_conv = DecodeError_clone(&e_conv);
13599         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
13600         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_err(e_conv);
13601         return tag_ptr(ret_conv, true);
13602 }
13603
13604 jboolean  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_is_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(uint64_t o) {
13605         LDKCResult_FixedPenaltyScorerDecodeErrorZ* o_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(o);
13606         jboolean ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o_conv);
13607         return ret_conv;
13608 }
13609
13610 void  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_free"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_free(uint64_t _res) {
13611         if (!ptr_is_owned(_res)) return;
13612         void* _res_ptr = untag_ptr(_res);
13613         CHECK_ACCESS(_res_ptr);
13614         LDKCResult_FixedPenaltyScorerDecodeErrorZ _res_conv = *(LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(_res_ptr);
13615         FREE(untag_ptr(_res));
13616         CResult_FixedPenaltyScorerDecodeErrorZ_free(_res_conv);
13617 }
13618
13619 static inline uint64_t CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR arg) {
13620         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
13621         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(arg);
13622         return tag_ptr(ret_conv, true);
13623 }
13624 int64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(uint64_t arg) {
13625         LDKCResult_FixedPenaltyScorerDecodeErrorZ* arg_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(arg);
13626         int64_t ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(arg_conv);
13627         return ret_conv;
13628 }
13629
13630 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone(uint64_t orig) {
13631         LDKCResult_FixedPenaltyScorerDecodeErrorZ* orig_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(orig);
13632         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
13633         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig_conv);
13634         return tag_ptr(ret_conv, true);
13635 }
13636
13637 static inline uint64_t C2Tuple_u64u64Z_clone_ptr(LDKC2Tuple_u64u64Z *NONNULL_PTR arg) {
13638         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
13639         *ret_conv = C2Tuple_u64u64Z_clone(arg);
13640         return tag_ptr(ret_conv, true);
13641 }
13642 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_clone_ptr"))) TS_C2Tuple_u64u64Z_clone_ptr(uint64_t arg) {
13643         LDKC2Tuple_u64u64Z* arg_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(arg);
13644         int64_t ret_conv = C2Tuple_u64u64Z_clone_ptr(arg_conv);
13645         return ret_conv;
13646 }
13647
13648 uint64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_clone"))) TS_C2Tuple_u64u64Z_clone(uint64_t orig) {
13649         LDKC2Tuple_u64u64Z* orig_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(orig);
13650         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
13651         *ret_conv = C2Tuple_u64u64Z_clone(orig_conv);
13652         return tag_ptr(ret_conv, true);
13653 }
13654
13655 uint64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_new"))) TS_C2Tuple_u64u64Z_new(int64_t a, int64_t b) {
13656         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
13657         *ret_conv = C2Tuple_u64u64Z_new(a, b);
13658         return tag_ptr(ret_conv, true);
13659 }
13660
13661 void  __attribute__((export_name("TS_C2Tuple_u64u64Z_free"))) TS_C2Tuple_u64u64Z_free(uint64_t _res) {
13662         if (!ptr_is_owned(_res)) return;
13663         void* _res_ptr = untag_ptr(_res);
13664         CHECK_ACCESS(_res_ptr);
13665         LDKC2Tuple_u64u64Z _res_conv = *(LDKC2Tuple_u64u64Z*)(_res_ptr);
13666         FREE(untag_ptr(_res));
13667         C2Tuple_u64u64Z_free(_res_conv);
13668 }
13669
13670 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_some"))) TS_COption_C2Tuple_u64u64ZZ_some(uint64_t o) {
13671         void* o_ptr = untag_ptr(o);
13672         CHECK_ACCESS(o_ptr);
13673         LDKC2Tuple_u64u64Z o_conv = *(LDKC2Tuple_u64u64Z*)(o_ptr);
13674         o_conv = C2Tuple_u64u64Z_clone((LDKC2Tuple_u64u64Z*)untag_ptr(o));
13675         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
13676         *ret_copy = COption_C2Tuple_u64u64ZZ_some(o_conv);
13677         uint64_t ret_ref = tag_ptr(ret_copy, true);
13678         return ret_ref;
13679 }
13680
13681 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_none"))) TS_COption_C2Tuple_u64u64ZZ_none() {
13682         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
13683         *ret_copy = COption_C2Tuple_u64u64ZZ_none();
13684         uint64_t ret_ref = tag_ptr(ret_copy, true);
13685         return ret_ref;
13686 }
13687
13688 void  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_free"))) TS_COption_C2Tuple_u64u64ZZ_free(uint64_t _res) {
13689         if (!ptr_is_owned(_res)) return;
13690         void* _res_ptr = untag_ptr(_res);
13691         CHECK_ACCESS(_res_ptr);
13692         LDKCOption_C2Tuple_u64u64ZZ _res_conv = *(LDKCOption_C2Tuple_u64u64ZZ*)(_res_ptr);
13693         FREE(untag_ptr(_res));
13694         COption_C2Tuple_u64u64ZZ_free(_res_conv);
13695 }
13696
13697 static inline uint64_t COption_C2Tuple_u64u64ZZ_clone_ptr(LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR arg) {
13698         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
13699         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(arg);
13700         uint64_t ret_ref = tag_ptr(ret_copy, true);
13701         return ret_ref;
13702 }
13703 int64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_clone_ptr"))) TS_COption_C2Tuple_u64u64ZZ_clone_ptr(uint64_t arg) {
13704         LDKCOption_C2Tuple_u64u64ZZ* arg_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(arg);
13705         int64_t ret_conv = COption_C2Tuple_u64u64ZZ_clone_ptr(arg_conv);
13706         return ret_conv;
13707 }
13708
13709 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_clone"))) TS_COption_C2Tuple_u64u64ZZ_clone(uint64_t orig) {
13710         LDKCOption_C2Tuple_u64u64ZZ* orig_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(orig);
13711         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
13712         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(orig_conv);
13713         uint64_t ret_ref = tag_ptr(ret_copy, true);
13714         return ret_ref;
13715 }
13716
13717 void  __attribute__((export_name("TS_CVec_NodeIdZ_free"))) TS_CVec_NodeIdZ_free(uint64_tArray _res) {
13718         LDKCVec_NodeIdZ _res_constr;
13719         _res_constr.datalen = _res->arr_len;
13720         if (_res_constr.datalen > 0)
13721                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
13722         else
13723                 _res_constr.data = NULL;
13724         uint64_t* _res_vals = _res->elems;
13725         for (size_t i = 0; i < _res_constr.datalen; i++) {
13726                 uint64_t _res_conv_8 = _res_vals[i];
13727                 LDKNodeId _res_conv_8_conv;
13728                 _res_conv_8_conv.inner = untag_ptr(_res_conv_8);
13729                 _res_conv_8_conv.is_owned = ptr_is_owned(_res_conv_8);
13730                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_8_conv);
13731                 _res_constr.data[i] = _res_conv_8_conv;
13732         }
13733         FREE(_res);
13734         CVec_NodeIdZ_free(_res_constr);
13735 }
13736
13737 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_ok(uint64_t o) {
13738         LDKProbabilisticScorer o_conv;
13739         o_conv.inner = untag_ptr(o);
13740         o_conv.is_owned = ptr_is_owned(o);
13741         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13742         // WARNING: we need a move here but no clone is available for LDKProbabilisticScorer
13743         
13744         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
13745         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_ok(o_conv);
13746         return tag_ptr(ret_conv, true);
13747 }
13748
13749 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_err"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_err(uint64_t e) {
13750         LDKDecodeError e_conv;
13751         e_conv.inner = untag_ptr(e);
13752         e_conv.is_owned = ptr_is_owned(e);
13753         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13754         e_conv = DecodeError_clone(&e_conv);
13755         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
13756         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_err(e_conv);
13757         return tag_ptr(ret_conv, true);
13758 }
13759
13760 jboolean  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_is_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_is_ok(uint64_t o) {
13761         LDKCResult_ProbabilisticScorerDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(o);
13762         jboolean ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o_conv);
13763         return ret_conv;
13764 }
13765
13766 void  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_free"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_free(uint64_t _res) {
13767         if (!ptr_is_owned(_res)) return;
13768         void* _res_ptr = untag_ptr(_res);
13769         CHECK_ACCESS(_res_ptr);
13770         LDKCResult_ProbabilisticScorerDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScorerDecodeErrorZ*)(_res_ptr);
13771         FREE(untag_ptr(_res));
13772         CResult_ProbabilisticScorerDecodeErrorZ_free(_res_conv);
13773 }
13774
13775 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_ok(uint64_t o) {
13776         LDKInitFeatures o_conv;
13777         o_conv.inner = untag_ptr(o);
13778         o_conv.is_owned = ptr_is_owned(o);
13779         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13780         o_conv = InitFeatures_clone(&o_conv);
13781         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
13782         *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
13783         return tag_ptr(ret_conv, true);
13784 }
13785
13786 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_err"))) TS_CResult_InitFeaturesDecodeErrorZ_err(uint64_t e) {
13787         LDKDecodeError e_conv;
13788         e_conv.inner = untag_ptr(e);
13789         e_conv.is_owned = ptr_is_owned(e);
13790         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13791         e_conv = DecodeError_clone(&e_conv);
13792         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
13793         *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
13794         return tag_ptr(ret_conv, true);
13795 }
13796
13797 jboolean  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_is_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_is_ok(uint64_t o) {
13798         LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(o);
13799         jboolean ret_conv = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
13800         return ret_conv;
13801 }
13802
13803 void  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_free"))) TS_CResult_InitFeaturesDecodeErrorZ_free(uint64_t _res) {
13804         if (!ptr_is_owned(_res)) return;
13805         void* _res_ptr = untag_ptr(_res);
13806         CHECK_ACCESS(_res_ptr);
13807         LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
13808         FREE(untag_ptr(_res));
13809         CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
13810 }
13811
13812 static inline uint64_t CResult_InitFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR arg) {
13813         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
13814         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(arg);
13815         return tag_ptr(ret_conv, true);
13816 }
13817 int64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_InitFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
13818         LDKCResult_InitFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(arg);
13819         int64_t ret_conv = CResult_InitFeaturesDecodeErrorZ_clone_ptr(arg_conv);
13820         return ret_conv;
13821 }
13822
13823 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_clone"))) TS_CResult_InitFeaturesDecodeErrorZ_clone(uint64_t orig) {
13824         LDKCResult_InitFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(orig);
13825         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
13826         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(orig_conv);
13827         return tag_ptr(ret_conv, true);
13828 }
13829
13830 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_ok(uint64_t o) {
13831         LDKChannelFeatures o_conv;
13832         o_conv.inner = untag_ptr(o);
13833         o_conv.is_owned = ptr_is_owned(o);
13834         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13835         o_conv = ChannelFeatures_clone(&o_conv);
13836         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
13837         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
13838         return tag_ptr(ret_conv, true);
13839 }
13840
13841 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_err"))) TS_CResult_ChannelFeaturesDecodeErrorZ_err(uint64_t e) {
13842         LDKDecodeError e_conv;
13843         e_conv.inner = untag_ptr(e);
13844         e_conv.is_owned = ptr_is_owned(e);
13845         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13846         e_conv = DecodeError_clone(&e_conv);
13847         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
13848         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
13849         return tag_ptr(ret_conv, true);
13850 }
13851
13852 jboolean  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok(uint64_t o) {
13853         LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(o);
13854         jboolean ret_conv = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
13855         return ret_conv;
13856 }
13857
13858 void  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_free"))) TS_CResult_ChannelFeaturesDecodeErrorZ_free(uint64_t _res) {
13859         if (!ptr_is_owned(_res)) return;
13860         void* _res_ptr = untag_ptr(_res);
13861         CHECK_ACCESS(_res_ptr);
13862         LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
13863         FREE(untag_ptr(_res));
13864         CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
13865 }
13866
13867 static inline uint64_t CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR arg) {
13868         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
13869         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(arg);
13870         return tag_ptr(ret_conv, true);
13871 }
13872 int64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
13873         LDKCResult_ChannelFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(arg);
13874         int64_t ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(arg_conv);
13875         return ret_conv;
13876 }
13877
13878 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_clone"))) TS_CResult_ChannelFeaturesDecodeErrorZ_clone(uint64_t orig) {
13879         LDKCResult_ChannelFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(orig);
13880         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
13881         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(orig_conv);
13882         return tag_ptr(ret_conv, true);
13883 }
13884
13885 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_ok(uint64_t o) {
13886         LDKNodeFeatures o_conv;
13887         o_conv.inner = untag_ptr(o);
13888         o_conv.is_owned = ptr_is_owned(o);
13889         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13890         o_conv = NodeFeatures_clone(&o_conv);
13891         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
13892         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
13893         return tag_ptr(ret_conv, true);
13894 }
13895
13896 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_err"))) TS_CResult_NodeFeaturesDecodeErrorZ_err(uint64_t e) {
13897         LDKDecodeError e_conv;
13898         e_conv.inner = untag_ptr(e);
13899         e_conv.is_owned = ptr_is_owned(e);
13900         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13901         e_conv = DecodeError_clone(&e_conv);
13902         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
13903         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
13904         return tag_ptr(ret_conv, true);
13905 }
13906
13907 jboolean  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_is_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_is_ok(uint64_t o) {
13908         LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(o);
13909         jboolean ret_conv = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
13910         return ret_conv;
13911 }
13912
13913 void  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_free"))) TS_CResult_NodeFeaturesDecodeErrorZ_free(uint64_t _res) {
13914         if (!ptr_is_owned(_res)) return;
13915         void* _res_ptr = untag_ptr(_res);
13916         CHECK_ACCESS(_res_ptr);
13917         LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
13918         FREE(untag_ptr(_res));
13919         CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
13920 }
13921
13922 static inline uint64_t CResult_NodeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
13923         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
13924         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(arg);
13925         return tag_ptr(ret_conv, true);
13926 }
13927 int64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_NodeFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
13928         LDKCResult_NodeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(arg);
13929         int64_t ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
13930         return ret_conv;
13931 }
13932
13933 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_clone"))) TS_CResult_NodeFeaturesDecodeErrorZ_clone(uint64_t orig) {
13934         LDKCResult_NodeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(orig);
13935         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
13936         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(orig_conv);
13937         return tag_ptr(ret_conv, true);
13938 }
13939
13940 uint64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_ok"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_ok(uint64_t o) {
13941         LDKInvoiceFeatures o_conv;
13942         o_conv.inner = untag_ptr(o);
13943         o_conv.is_owned = ptr_is_owned(o);
13944         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13945         o_conv = InvoiceFeatures_clone(&o_conv);
13946         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
13947         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
13948         return tag_ptr(ret_conv, true);
13949 }
13950
13951 uint64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_err"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_err(uint64_t e) {
13952         LDKDecodeError e_conv;
13953         e_conv.inner = untag_ptr(e);
13954         e_conv.is_owned = ptr_is_owned(e);
13955         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13956         e_conv = DecodeError_clone(&e_conv);
13957         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
13958         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
13959         return tag_ptr(ret_conv, true);
13960 }
13961
13962 jboolean  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_is_ok"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_is_ok(uint64_t o) {
13963         LDKCResult_InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
13964         jboolean ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
13965         return ret_conv;
13966 }
13967
13968 void  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_free"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_free(uint64_t _res) {
13969         if (!ptr_is_owned(_res)) return;
13970         void* _res_ptr = untag_ptr(_res);
13971         CHECK_ACCESS(_res_ptr);
13972         LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
13973         FREE(untag_ptr(_res));
13974         CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
13975 }
13976
13977 static inline uint64_t CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
13978         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
13979         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone(arg);
13980         return tag_ptr(ret_conv, true);
13981 }
13982 int64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
13983         LDKCResult_InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
13984         int64_t ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
13985         return ret_conv;
13986 }
13987
13988 uint64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_clone"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_clone(uint64_t orig) {
13989         LDKCResult_InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
13990         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
13991         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
13992         return tag_ptr(ret_conv, true);
13993 }
13994
13995 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok(uint64_t o) {
13996         LDKChannelTypeFeatures o_conv;
13997         o_conv.inner = untag_ptr(o);
13998         o_conv.is_owned = ptr_is_owned(o);
13999         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14000         o_conv = ChannelTypeFeatures_clone(&o_conv);
14001         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
14002         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv);
14003         return tag_ptr(ret_conv, true);
14004 }
14005
14006 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err(uint64_t e) {
14007         LDKDecodeError e_conv;
14008         e_conv.inner = untag_ptr(e);
14009         e_conv.is_owned = ptr_is_owned(e);
14010         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14011         e_conv = DecodeError_clone(&e_conv);
14012         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
14013         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv);
14014         return tag_ptr(ret_conv, true);
14015 }
14016
14017 jboolean  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(uint64_t o) {
14018         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(o);
14019         jboolean ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv);
14020         return ret_conv;
14021 }
14022
14023 void  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free(uint64_t _res) {
14024         if (!ptr_is_owned(_res)) return;
14025         void* _res_ptr = untag_ptr(_res);
14026         CHECK_ACCESS(_res_ptr);
14027         LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr);
14028         FREE(untag_ptr(_res));
14029         CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv);
14030 }
14031
14032 static inline uint64_t CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
14033         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
14034         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(arg);
14035         return tag_ptr(ret_conv, true);
14036 }
14037 int64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
14038         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(arg);
14039         int64_t ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
14040         return ret_conv;
14041 }
14042
14043 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone(uint64_t orig) {
14044         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(orig);
14045         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
14046         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig_conv);
14047         return tag_ptr(ret_conv, true);
14048 }
14049
14050 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_ok"))) TS_CResult_NodeIdDecodeErrorZ_ok(uint64_t o) {
14051         LDKNodeId o_conv;
14052         o_conv.inner = untag_ptr(o);
14053         o_conv.is_owned = ptr_is_owned(o);
14054         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14055         o_conv = NodeId_clone(&o_conv);
14056         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
14057         *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
14058         return tag_ptr(ret_conv, true);
14059 }
14060
14061 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_err"))) TS_CResult_NodeIdDecodeErrorZ_err(uint64_t e) {
14062         LDKDecodeError e_conv;
14063         e_conv.inner = untag_ptr(e);
14064         e_conv.is_owned = ptr_is_owned(e);
14065         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14066         e_conv = DecodeError_clone(&e_conv);
14067         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
14068         *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
14069         return tag_ptr(ret_conv, true);
14070 }
14071
14072 jboolean  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_is_ok"))) TS_CResult_NodeIdDecodeErrorZ_is_ok(uint64_t o) {
14073         LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(o);
14074         jboolean ret_conv = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
14075         return ret_conv;
14076 }
14077
14078 void  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_free"))) TS_CResult_NodeIdDecodeErrorZ_free(uint64_t _res) {
14079         if (!ptr_is_owned(_res)) return;
14080         void* _res_ptr = untag_ptr(_res);
14081         CHECK_ACCESS(_res_ptr);
14082         LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
14083         FREE(untag_ptr(_res));
14084         CResult_NodeIdDecodeErrorZ_free(_res_conv);
14085 }
14086
14087 static inline uint64_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
14088         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
14089         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
14090         return tag_ptr(ret_conv, true);
14091 }
14092 int64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_clone_ptr"))) TS_CResult_NodeIdDecodeErrorZ_clone_ptr(uint64_t arg) {
14093         LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(arg);
14094         int64_t ret_conv = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
14095         return ret_conv;
14096 }
14097
14098 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_clone"))) TS_CResult_NodeIdDecodeErrorZ_clone(uint64_t orig) {
14099         LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(orig);
14100         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
14101         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
14102         return tag_ptr(ret_conv, true);
14103 }
14104
14105 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok(uint64_t o) {
14106         void* o_ptr = untag_ptr(o);
14107         CHECK_ACCESS(o_ptr);
14108         LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
14109         o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(o));
14110         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
14111         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
14112         return tag_ptr(ret_conv, true);
14113 }
14114
14115 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err(uint64_t e) {
14116         LDKDecodeError e_conv;
14117         e_conv.inner = untag_ptr(e);
14118         e_conv.is_owned = ptr_is_owned(e);
14119         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14120         e_conv = DecodeError_clone(&e_conv);
14121         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
14122         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
14123         return tag_ptr(ret_conv, true);
14124 }
14125
14126 jboolean  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(uint64_t o) {
14127         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(o);
14128         jboolean ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
14129         return ret_conv;
14130 }
14131
14132 void  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free(uint64_t _res) {
14133         if (!ptr_is_owned(_res)) return;
14134         void* _res_ptr = untag_ptr(_res);
14135         CHECK_ACCESS(_res_ptr);
14136         LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
14137         FREE(untag_ptr(_res));
14138         CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
14139 }
14140
14141 static inline uint64_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
14142         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
14143         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
14144         return tag_ptr(ret_conv, true);
14145 }
14146 int64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(uint64_t arg) {
14147         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(arg);
14148         int64_t ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
14149         return ret_conv;
14150 }
14151
14152 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone(uint64_t orig) {
14153         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(orig);
14154         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
14155         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
14156         return tag_ptr(ret_conv, true);
14157 }
14158
14159 uint64_t  __attribute__((export_name("TS_COption_AccessZ_some"))) TS_COption_AccessZ_some(uint64_t o) {
14160         void* o_ptr = untag_ptr(o);
14161         CHECK_ACCESS(o_ptr);
14162         LDKAccess o_conv = *(LDKAccess*)(o_ptr);
14163         if (o_conv.free == LDKAccess_JCalls_free) {
14164                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14165                 LDKAccess_JCalls_cloned(&o_conv);
14166         }
14167         LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
14168         *ret_copy = COption_AccessZ_some(o_conv);
14169         uint64_t ret_ref = tag_ptr(ret_copy, true);
14170         return ret_ref;
14171 }
14172
14173 uint64_t  __attribute__((export_name("TS_COption_AccessZ_none"))) TS_COption_AccessZ_none() {
14174         LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
14175         *ret_copy = COption_AccessZ_none();
14176         uint64_t ret_ref = tag_ptr(ret_copy, true);
14177         return ret_ref;
14178 }
14179
14180 void  __attribute__((export_name("TS_COption_AccessZ_free"))) TS_COption_AccessZ_free(uint64_t _res) {
14181         if (!ptr_is_owned(_res)) return;
14182         void* _res_ptr = untag_ptr(_res);
14183         CHECK_ACCESS(_res_ptr);
14184         LDKCOption_AccessZ _res_conv = *(LDKCOption_AccessZ*)(_res_ptr);
14185         FREE(untag_ptr(_res));
14186         COption_AccessZ_free(_res_conv);
14187 }
14188
14189 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_ok"))) TS_CResult_boolLightningErrorZ_ok(jboolean o) {
14190         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
14191         *ret_conv = CResult_boolLightningErrorZ_ok(o);
14192         return tag_ptr(ret_conv, true);
14193 }
14194
14195 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_err"))) TS_CResult_boolLightningErrorZ_err(uint64_t e) {
14196         LDKLightningError e_conv;
14197         e_conv.inner = untag_ptr(e);
14198         e_conv.is_owned = ptr_is_owned(e);
14199         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14200         e_conv = LightningError_clone(&e_conv);
14201         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
14202         *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
14203         return tag_ptr(ret_conv, true);
14204 }
14205
14206 jboolean  __attribute__((export_name("TS_CResult_boolLightningErrorZ_is_ok"))) TS_CResult_boolLightningErrorZ_is_ok(uint64_t o) {
14207         LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(o);
14208         jboolean ret_conv = CResult_boolLightningErrorZ_is_ok(o_conv);
14209         return ret_conv;
14210 }
14211
14212 void  __attribute__((export_name("TS_CResult_boolLightningErrorZ_free"))) TS_CResult_boolLightningErrorZ_free(uint64_t _res) {
14213         if (!ptr_is_owned(_res)) return;
14214         void* _res_ptr = untag_ptr(_res);
14215         CHECK_ACCESS(_res_ptr);
14216         LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
14217         FREE(untag_ptr(_res));
14218         CResult_boolLightningErrorZ_free(_res_conv);
14219 }
14220
14221 static inline uint64_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
14222         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
14223         *ret_conv = CResult_boolLightningErrorZ_clone(arg);
14224         return tag_ptr(ret_conv, true);
14225 }
14226 int64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_clone_ptr"))) TS_CResult_boolLightningErrorZ_clone_ptr(uint64_t arg) {
14227         LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(arg);
14228         int64_t ret_conv = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
14229         return ret_conv;
14230 }
14231
14232 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_clone"))) TS_CResult_boolLightningErrorZ_clone(uint64_t orig) {
14233         LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(orig);
14234         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
14235         *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
14236         return tag_ptr(ret_conv, true);
14237 }
14238
14239 static inline uint64_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
14240         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
14241         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
14242         return tag_ptr(ret_conv, true);
14243 }
14244 int64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(uint64_t arg) {
14245         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(arg);
14246         int64_t ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
14247         return ret_conv;
14248 }
14249
14250 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(uint64_t orig) {
14251         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(orig);
14252         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
14253         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
14254         return tag_ptr(ret_conv, true);
14255 }
14256
14257 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint64_t a, uint64_t b, uint64_t c) {
14258         LDKChannelAnnouncement a_conv;
14259         a_conv.inner = untag_ptr(a);
14260         a_conv.is_owned = ptr_is_owned(a);
14261         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
14262         a_conv = ChannelAnnouncement_clone(&a_conv);
14263         LDKChannelUpdate b_conv;
14264         b_conv.inner = untag_ptr(b);
14265         b_conv.is_owned = ptr_is_owned(b);
14266         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
14267         b_conv = ChannelUpdate_clone(&b_conv);
14268         LDKChannelUpdate c_conv;
14269         c_conv.inner = untag_ptr(c);
14270         c_conv.is_owned = ptr_is_owned(c);
14271         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
14272         c_conv = ChannelUpdate_clone(&c_conv);
14273         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
14274         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
14275         return tag_ptr(ret_conv, true);
14276 }
14277
14278 void  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(uint64_t _res) {
14279         if (!ptr_is_owned(_res)) return;
14280         void* _res_ptr = untag_ptr(_res);
14281         CHECK_ACCESS(_res_ptr);
14282         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
14283         FREE(untag_ptr(_res));
14284         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
14285 }
14286
14287 uint64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(uint64_t o) {
14288         void* o_ptr = untag_ptr(o);
14289         CHECK_ACCESS(o_ptr);
14290         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ o_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(o_ptr);
14291         o_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(o));
14292         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
14293         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o_conv);
14294         uint64_t ret_ref = tag_ptr(ret_copy, true);
14295         return ret_ref;
14296 }
14297
14298 uint64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none() {
14299         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
14300         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none();
14301         uint64_t ret_ref = tag_ptr(ret_copy, true);
14302         return ret_ref;
14303 }
14304
14305 void  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(uint64_t _res) {
14306         if (!ptr_is_owned(_res)) return;
14307         void* _res_ptr = untag_ptr(_res);
14308         CHECK_ACCESS(_res_ptr);
14309         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(_res_ptr);
14310         FREE(untag_ptr(_res));
14311         COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_conv);
14312 }
14313
14314 static inline uint64_t COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *NONNULL_PTR arg) {
14315         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
14316         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(arg);
14317         uint64_t ret_ref = tag_ptr(ret_copy, true);
14318         return ret_ref;
14319 }
14320 int64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(uint64_t arg) {
14321         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* arg_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(arg);
14322         int64_t ret_conv = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(arg_conv);
14323         return ret_conv;
14324 }
14325
14326 uint64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(uint64_t orig) {
14327         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* orig_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(orig);
14328         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
14329         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig_conv);
14330         uint64_t ret_ref = tag_ptr(ret_copy, true);
14331         return ret_ref;
14332 }
14333
14334 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_ok"))) TS_CResult_NoneLightningErrorZ_ok() {
14335         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
14336         *ret_conv = CResult_NoneLightningErrorZ_ok();
14337         return tag_ptr(ret_conv, true);
14338 }
14339
14340 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_err"))) TS_CResult_NoneLightningErrorZ_err(uint64_t e) {
14341         LDKLightningError e_conv;
14342         e_conv.inner = untag_ptr(e);
14343         e_conv.is_owned = ptr_is_owned(e);
14344         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14345         e_conv = LightningError_clone(&e_conv);
14346         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
14347         *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
14348         return tag_ptr(ret_conv, true);
14349 }
14350
14351 jboolean  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_is_ok"))) TS_CResult_NoneLightningErrorZ_is_ok(uint64_t o) {
14352         LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(o);
14353         jboolean ret_conv = CResult_NoneLightningErrorZ_is_ok(o_conv);
14354         return ret_conv;
14355 }
14356
14357 void  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_free"))) TS_CResult_NoneLightningErrorZ_free(uint64_t _res) {
14358         if (!ptr_is_owned(_res)) return;
14359         void* _res_ptr = untag_ptr(_res);
14360         CHECK_ACCESS(_res_ptr);
14361         LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
14362         FREE(untag_ptr(_res));
14363         CResult_NoneLightningErrorZ_free(_res_conv);
14364 }
14365
14366 static inline uint64_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
14367         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
14368         *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
14369         return tag_ptr(ret_conv, true);
14370 }
14371 int64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_clone_ptr"))) TS_CResult_NoneLightningErrorZ_clone_ptr(uint64_t arg) {
14372         LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(arg);
14373         int64_t ret_conv = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
14374         return ret_conv;
14375 }
14376
14377 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_clone"))) TS_CResult_NoneLightningErrorZ_clone(uint64_t orig) {
14378         LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(orig);
14379         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
14380         *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
14381         return tag_ptr(ret_conv, true);
14382 }
14383
14384 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_ok(uint64_t o) {
14385         LDKChannelUpdateInfo o_conv;
14386         o_conv.inner = untag_ptr(o);
14387         o_conv.is_owned = ptr_is_owned(o);
14388         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14389         o_conv = ChannelUpdateInfo_clone(&o_conv);
14390         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
14391         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_ok(o_conv);
14392         return tag_ptr(ret_conv, true);
14393 }
14394
14395 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_err"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_err(uint64_t e) {
14396         LDKDecodeError e_conv;
14397         e_conv.inner = untag_ptr(e);
14398         e_conv.is_owned = ptr_is_owned(e);
14399         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14400         e_conv = DecodeError_clone(&e_conv);
14401         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
14402         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_err(e_conv);
14403         return tag_ptr(ret_conv, true);
14404 }
14405
14406 jboolean  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_is_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(uint64_t o) {
14407         LDKCResult_ChannelUpdateInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(o);
14408         jboolean ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o_conv);
14409         return ret_conv;
14410 }
14411
14412 void  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_free"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_free(uint64_t _res) {
14413         if (!ptr_is_owned(_res)) return;
14414         void* _res_ptr = untag_ptr(_res);
14415         CHECK_ACCESS(_res_ptr);
14416         LDKCResult_ChannelUpdateInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(_res_ptr);
14417         FREE(untag_ptr(_res));
14418         CResult_ChannelUpdateInfoDecodeErrorZ_free(_res_conv);
14419 }
14420
14421 static inline uint64_t CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR arg) {
14422         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
14423         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(arg);
14424         return tag_ptr(ret_conv, true);
14425 }
14426 int64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
14427         LDKCResult_ChannelUpdateInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(arg);
14428         int64_t ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(arg_conv);
14429         return ret_conv;
14430 }
14431
14432 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone(uint64_t orig) {
14433         LDKCResult_ChannelUpdateInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(orig);
14434         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
14435         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig_conv);
14436         return tag_ptr(ret_conv, true);
14437 }
14438
14439 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_ok(uint64_t o) {
14440         LDKChannelInfo o_conv;
14441         o_conv.inner = untag_ptr(o);
14442         o_conv.is_owned = ptr_is_owned(o);
14443         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14444         o_conv = ChannelInfo_clone(&o_conv);
14445         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
14446         *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
14447         return tag_ptr(ret_conv, true);
14448 }
14449
14450 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_err"))) TS_CResult_ChannelInfoDecodeErrorZ_err(uint64_t e) {
14451         LDKDecodeError e_conv;
14452         e_conv.inner = untag_ptr(e);
14453         e_conv.is_owned = ptr_is_owned(e);
14454         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14455         e_conv = DecodeError_clone(&e_conv);
14456         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
14457         *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
14458         return tag_ptr(ret_conv, true);
14459 }
14460
14461 jboolean  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_is_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_is_ok(uint64_t o) {
14462         LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(o);
14463         jboolean ret_conv = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
14464         return ret_conv;
14465 }
14466
14467 void  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_free"))) TS_CResult_ChannelInfoDecodeErrorZ_free(uint64_t _res) {
14468         if (!ptr_is_owned(_res)) return;
14469         void* _res_ptr = untag_ptr(_res);
14470         CHECK_ACCESS(_res_ptr);
14471         LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
14472         FREE(untag_ptr(_res));
14473         CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
14474 }
14475
14476 static inline uint64_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
14477         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
14478         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
14479         return tag_ptr(ret_conv, true);
14480 }
14481 int64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
14482         LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(arg);
14483         int64_t ret_conv = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
14484         return ret_conv;
14485 }
14486
14487 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_clone"))) TS_CResult_ChannelInfoDecodeErrorZ_clone(uint64_t orig) {
14488         LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(orig);
14489         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
14490         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
14491         return tag_ptr(ret_conv, true);
14492 }
14493
14494 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_ok(uint64_t o) {
14495         LDKRoutingFees o_conv;
14496         o_conv.inner = untag_ptr(o);
14497         o_conv.is_owned = ptr_is_owned(o);
14498         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14499         o_conv = RoutingFees_clone(&o_conv);
14500         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
14501         *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
14502         return tag_ptr(ret_conv, true);
14503 }
14504
14505 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_err"))) TS_CResult_RoutingFeesDecodeErrorZ_err(uint64_t e) {
14506         LDKDecodeError e_conv;
14507         e_conv.inner = untag_ptr(e);
14508         e_conv.is_owned = ptr_is_owned(e);
14509         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14510         e_conv = DecodeError_clone(&e_conv);
14511         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
14512         *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
14513         return tag_ptr(ret_conv, true);
14514 }
14515
14516 jboolean  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_is_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_is_ok(uint64_t o) {
14517         LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(o);
14518         jboolean ret_conv = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
14519         return ret_conv;
14520 }
14521
14522 void  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_free"))) TS_CResult_RoutingFeesDecodeErrorZ_free(uint64_t _res) {
14523         if (!ptr_is_owned(_res)) return;
14524         void* _res_ptr = untag_ptr(_res);
14525         CHECK_ACCESS(_res_ptr);
14526         LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
14527         FREE(untag_ptr(_res));
14528         CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
14529 }
14530
14531 static inline uint64_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
14532         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
14533         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
14534         return tag_ptr(ret_conv, true);
14535 }
14536 int64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr"))) TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr(uint64_t arg) {
14537         LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(arg);
14538         int64_t ret_conv = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
14539         return ret_conv;
14540 }
14541
14542 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_clone"))) TS_CResult_RoutingFeesDecodeErrorZ_clone(uint64_t orig) {
14543         LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(orig);
14544         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
14545         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
14546         return tag_ptr(ret_conv, true);
14547 }
14548
14549 void  __attribute__((export_name("TS_CVec_NetAddressZ_free"))) TS_CVec_NetAddressZ_free(uint64_tArray _res) {
14550         LDKCVec_NetAddressZ _res_constr;
14551         _res_constr.datalen = _res->arr_len;
14552         if (_res_constr.datalen > 0)
14553                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
14554         else
14555                 _res_constr.data = NULL;
14556         uint64_t* _res_vals = _res->elems;
14557         for (size_t m = 0; m < _res_constr.datalen; m++) {
14558                 uint64_t _res_conv_12 = _res_vals[m];
14559                 void* _res_conv_12_ptr = untag_ptr(_res_conv_12);
14560                 CHECK_ACCESS(_res_conv_12_ptr);
14561                 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(_res_conv_12_ptr);
14562                 FREE(untag_ptr(_res_conv_12));
14563                 _res_constr.data[m] = _res_conv_12_conv;
14564         }
14565         FREE(_res);
14566         CVec_NetAddressZ_free(_res_constr);
14567 }
14568
14569 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok(uint64_t o) {
14570         LDKNodeAnnouncementInfo o_conv;
14571         o_conv.inner = untag_ptr(o);
14572         o_conv.is_owned = ptr_is_owned(o);
14573         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14574         o_conv = NodeAnnouncementInfo_clone(&o_conv);
14575         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
14576         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
14577         return tag_ptr(ret_conv, true);
14578 }
14579
14580 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err(uint64_t e) {
14581         LDKDecodeError e_conv;
14582         e_conv.inner = untag_ptr(e);
14583         e_conv.is_owned = ptr_is_owned(e);
14584         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14585         e_conv = DecodeError_clone(&e_conv);
14586         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
14587         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
14588         return tag_ptr(ret_conv, true);
14589 }
14590
14591 jboolean  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(uint64_t o) {
14592         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(o);
14593         jboolean ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
14594         return ret_conv;
14595 }
14596
14597 void  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free(uint64_t _res) {
14598         if (!ptr_is_owned(_res)) return;
14599         void* _res_ptr = untag_ptr(_res);
14600         CHECK_ACCESS(_res_ptr);
14601         LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
14602         FREE(untag_ptr(_res));
14603         CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
14604 }
14605
14606 static inline uint64_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
14607         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
14608         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
14609         return tag_ptr(ret_conv, true);
14610 }
14611 int64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
14612         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(arg);
14613         int64_t ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
14614         return ret_conv;
14615 }
14616
14617 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone(uint64_t orig) {
14618         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(orig);
14619         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
14620         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
14621         return tag_ptr(ret_conv, true);
14622 }
14623
14624 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_ok"))) TS_CResult_NodeAliasDecodeErrorZ_ok(uint64_t o) {
14625         LDKNodeAlias o_conv;
14626         o_conv.inner = untag_ptr(o);
14627         o_conv.is_owned = ptr_is_owned(o);
14628         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14629         o_conv = NodeAlias_clone(&o_conv);
14630         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
14631         *ret_conv = CResult_NodeAliasDecodeErrorZ_ok(o_conv);
14632         return tag_ptr(ret_conv, true);
14633 }
14634
14635 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_err"))) TS_CResult_NodeAliasDecodeErrorZ_err(uint64_t e) {
14636         LDKDecodeError e_conv;
14637         e_conv.inner = untag_ptr(e);
14638         e_conv.is_owned = ptr_is_owned(e);
14639         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14640         e_conv = DecodeError_clone(&e_conv);
14641         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
14642         *ret_conv = CResult_NodeAliasDecodeErrorZ_err(e_conv);
14643         return tag_ptr(ret_conv, true);
14644 }
14645
14646 jboolean  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_is_ok"))) TS_CResult_NodeAliasDecodeErrorZ_is_ok(uint64_t o) {
14647         LDKCResult_NodeAliasDecodeErrorZ* o_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(o);
14648         jboolean ret_conv = CResult_NodeAliasDecodeErrorZ_is_ok(o_conv);
14649         return ret_conv;
14650 }
14651
14652 void  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_free"))) TS_CResult_NodeAliasDecodeErrorZ_free(uint64_t _res) {
14653         if (!ptr_is_owned(_res)) return;
14654         void* _res_ptr = untag_ptr(_res);
14655         CHECK_ACCESS(_res_ptr);
14656         LDKCResult_NodeAliasDecodeErrorZ _res_conv = *(LDKCResult_NodeAliasDecodeErrorZ*)(_res_ptr);
14657         FREE(untag_ptr(_res));
14658         CResult_NodeAliasDecodeErrorZ_free(_res_conv);
14659 }
14660
14661 static inline uint64_t CResult_NodeAliasDecodeErrorZ_clone_ptr(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR arg) {
14662         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
14663         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(arg);
14664         return tag_ptr(ret_conv, true);
14665 }
14666 int64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAliasDecodeErrorZ_clone_ptr(uint64_t arg) {
14667         LDKCResult_NodeAliasDecodeErrorZ* arg_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(arg);
14668         int64_t ret_conv = CResult_NodeAliasDecodeErrorZ_clone_ptr(arg_conv);
14669         return ret_conv;
14670 }
14671
14672 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_clone"))) TS_CResult_NodeAliasDecodeErrorZ_clone(uint64_t orig) {
14673         LDKCResult_NodeAliasDecodeErrorZ* orig_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(orig);
14674         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
14675         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(orig_conv);
14676         return tag_ptr(ret_conv, true);
14677 }
14678
14679 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_ok"))) TS_CResult_NodeInfoDecodeErrorZ_ok(uint64_t o) {
14680         LDKNodeInfo o_conv;
14681         o_conv.inner = untag_ptr(o);
14682         o_conv.is_owned = ptr_is_owned(o);
14683         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14684         o_conv = NodeInfo_clone(&o_conv);
14685         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
14686         *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
14687         return tag_ptr(ret_conv, true);
14688 }
14689
14690 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_err"))) TS_CResult_NodeInfoDecodeErrorZ_err(uint64_t e) {
14691         LDKDecodeError e_conv;
14692         e_conv.inner = untag_ptr(e);
14693         e_conv.is_owned = ptr_is_owned(e);
14694         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14695         e_conv = DecodeError_clone(&e_conv);
14696         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
14697         *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
14698         return tag_ptr(ret_conv, true);
14699 }
14700
14701 jboolean  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_is_ok"))) TS_CResult_NodeInfoDecodeErrorZ_is_ok(uint64_t o) {
14702         LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(o);
14703         jboolean ret_conv = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
14704         return ret_conv;
14705 }
14706
14707 void  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_free"))) TS_CResult_NodeInfoDecodeErrorZ_free(uint64_t _res) {
14708         if (!ptr_is_owned(_res)) return;
14709         void* _res_ptr = untag_ptr(_res);
14710         CHECK_ACCESS(_res_ptr);
14711         LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
14712         FREE(untag_ptr(_res));
14713         CResult_NodeInfoDecodeErrorZ_free(_res_conv);
14714 }
14715
14716 static inline uint64_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
14717         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
14718         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
14719         return tag_ptr(ret_conv, true);
14720 }
14721 int64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_clone_ptr"))) TS_CResult_NodeInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
14722         LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(arg);
14723         int64_t ret_conv = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
14724         return ret_conv;
14725 }
14726
14727 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_clone"))) TS_CResult_NodeInfoDecodeErrorZ_clone(uint64_t orig) {
14728         LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(orig);
14729         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
14730         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
14731         return tag_ptr(ret_conv, true);
14732 }
14733
14734 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_ok(uint64_t o) {
14735         LDKNetworkGraph o_conv;
14736         o_conv.inner = untag_ptr(o);
14737         o_conv.is_owned = ptr_is_owned(o);
14738         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14739         // WARNING: we need a move here but no clone is available for LDKNetworkGraph
14740         
14741         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
14742         *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
14743         return tag_ptr(ret_conv, true);
14744 }
14745
14746 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_err"))) TS_CResult_NetworkGraphDecodeErrorZ_err(uint64_t e) {
14747         LDKDecodeError e_conv;
14748         e_conv.inner = untag_ptr(e);
14749         e_conv.is_owned = ptr_is_owned(e);
14750         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14751         e_conv = DecodeError_clone(&e_conv);
14752         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
14753         *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
14754         return tag_ptr(ret_conv, true);
14755 }
14756
14757 jboolean  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_is_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_is_ok(uint64_t o) {
14758         LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(o);
14759         jboolean ret_conv = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
14760         return ret_conv;
14761 }
14762
14763 void  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_free"))) TS_CResult_NetworkGraphDecodeErrorZ_free(uint64_t _res) {
14764         if (!ptr_is_owned(_res)) return;
14765         void* _res_ptr = untag_ptr(_res);
14766         CHECK_ACCESS(_res_ptr);
14767         LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
14768         FREE(untag_ptr(_res));
14769         CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
14770 }
14771
14772 uint64_t  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_some"))) TS_COption_CVec_NetAddressZZ_some(uint64_tArray o) {
14773         LDKCVec_NetAddressZ o_constr;
14774         o_constr.datalen = o->arr_len;
14775         if (o_constr.datalen > 0)
14776                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
14777         else
14778                 o_constr.data = NULL;
14779         uint64_t* o_vals = o->elems;
14780         for (size_t m = 0; m < o_constr.datalen; m++) {
14781                 uint64_t o_conv_12 = o_vals[m];
14782                 void* o_conv_12_ptr = untag_ptr(o_conv_12);
14783                 CHECK_ACCESS(o_conv_12_ptr);
14784                 LDKNetAddress o_conv_12_conv = *(LDKNetAddress*)(o_conv_12_ptr);
14785                 o_conv_12_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o_conv_12));
14786                 o_constr.data[m] = o_conv_12_conv;
14787         }
14788         FREE(o);
14789         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
14790         *ret_copy = COption_CVec_NetAddressZZ_some(o_constr);
14791         uint64_t ret_ref = tag_ptr(ret_copy, true);
14792         return ret_ref;
14793 }
14794
14795 uint64_t  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_none"))) TS_COption_CVec_NetAddressZZ_none() {
14796         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
14797         *ret_copy = COption_CVec_NetAddressZZ_none();
14798         uint64_t ret_ref = tag_ptr(ret_copy, true);
14799         return ret_ref;
14800 }
14801
14802 void  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_free"))) TS_COption_CVec_NetAddressZZ_free(uint64_t _res) {
14803         if (!ptr_is_owned(_res)) return;
14804         void* _res_ptr = untag_ptr(_res);
14805         CHECK_ACCESS(_res_ptr);
14806         LDKCOption_CVec_NetAddressZZ _res_conv = *(LDKCOption_CVec_NetAddressZZ*)(_res_ptr);
14807         FREE(untag_ptr(_res));
14808         COption_CVec_NetAddressZZ_free(_res_conv);
14809 }
14810
14811 static inline uint64_t COption_CVec_NetAddressZZ_clone_ptr(LDKCOption_CVec_NetAddressZZ *NONNULL_PTR arg) {
14812         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
14813         *ret_copy = COption_CVec_NetAddressZZ_clone(arg);
14814         uint64_t ret_ref = tag_ptr(ret_copy, true);
14815         return ret_ref;
14816 }
14817 int64_t  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_clone_ptr"))) TS_COption_CVec_NetAddressZZ_clone_ptr(uint64_t arg) {
14818         LDKCOption_CVec_NetAddressZZ* arg_conv = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(arg);
14819         int64_t ret_conv = COption_CVec_NetAddressZZ_clone_ptr(arg_conv);
14820         return ret_conv;
14821 }
14822
14823 uint64_t  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_clone"))) TS_COption_CVec_NetAddressZZ_clone(uint64_t orig) {
14824         LDKCOption_CVec_NetAddressZZ* orig_conv = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(orig);
14825         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
14826         *ret_copy = COption_CVec_NetAddressZZ_clone(orig_conv);
14827         uint64_t ret_ref = tag_ptr(ret_copy, true);
14828         return ret_ref;
14829 }
14830
14831 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
14832         LDKDelayedPaymentOutputDescriptor o_conv;
14833         o_conv.inner = untag_ptr(o);
14834         o_conv.is_owned = ptr_is_owned(o);
14835         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14836         o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
14837         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
14838         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
14839         return tag_ptr(ret_conv, true);
14840 }
14841
14842 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(uint64_t e) {
14843         LDKDecodeError e_conv;
14844         e_conv.inner = untag_ptr(e);
14845         e_conv.is_owned = ptr_is_owned(e);
14846         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14847         e_conv = DecodeError_clone(&e_conv);
14848         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
14849         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
14850         return tag_ptr(ret_conv, true);
14851 }
14852
14853 jboolean  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
14854         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
14855         jboolean ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
14856         return ret_conv;
14857 }
14858
14859 void  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
14860         if (!ptr_is_owned(_res)) return;
14861         void* _res_ptr = untag_ptr(_res);
14862         CHECK_ACCESS(_res_ptr);
14863         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
14864         FREE(untag_ptr(_res));
14865         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
14866 }
14867
14868 static inline uint64_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
14869         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
14870         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
14871         return tag_ptr(ret_conv, true);
14872 }
14873 int64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
14874         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
14875         int64_t ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
14876         return ret_conv;
14877 }
14878
14879 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
14880         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
14881         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
14882         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
14883         return tag_ptr(ret_conv, true);
14884 }
14885
14886 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
14887         LDKStaticPaymentOutputDescriptor o_conv;
14888         o_conv.inner = untag_ptr(o);
14889         o_conv.is_owned = ptr_is_owned(o);
14890         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14891         o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
14892         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
14893         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
14894         return tag_ptr(ret_conv, true);
14895 }
14896
14897 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(uint64_t e) {
14898         LDKDecodeError e_conv;
14899         e_conv.inner = untag_ptr(e);
14900         e_conv.is_owned = ptr_is_owned(e);
14901         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14902         e_conv = DecodeError_clone(&e_conv);
14903         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
14904         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
14905         return tag_ptr(ret_conv, true);
14906 }
14907
14908 jboolean  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
14909         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
14910         jboolean ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
14911         return ret_conv;
14912 }
14913
14914 void  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
14915         if (!ptr_is_owned(_res)) return;
14916         void* _res_ptr = untag_ptr(_res);
14917         CHECK_ACCESS(_res_ptr);
14918         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
14919         FREE(untag_ptr(_res));
14920         CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
14921 }
14922
14923 static inline uint64_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
14924         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
14925         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
14926         return tag_ptr(ret_conv, true);
14927 }
14928 int64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
14929         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
14930         int64_t ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
14931         return ret_conv;
14932 }
14933
14934 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
14935         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
14936         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
14937         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
14938         return tag_ptr(ret_conv, true);
14939 }
14940
14941 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
14942         void* o_ptr = untag_ptr(o);
14943         CHECK_ACCESS(o_ptr);
14944         LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
14945         o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(o));
14946         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
14947         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
14948         return tag_ptr(ret_conv, true);
14949 }
14950
14951 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err(uint64_t e) {
14952         LDKDecodeError e_conv;
14953         e_conv.inner = untag_ptr(e);
14954         e_conv.is_owned = ptr_is_owned(e);
14955         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14956         e_conv = DecodeError_clone(&e_conv);
14957         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
14958         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
14959         return tag_ptr(ret_conv, true);
14960 }
14961
14962 jboolean  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
14963         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(o);
14964         jboolean ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
14965         return ret_conv;
14966 }
14967
14968 void  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
14969         if (!ptr_is_owned(_res)) return;
14970         void* _res_ptr = untag_ptr(_res);
14971         CHECK_ACCESS(_res_ptr);
14972         LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
14973         FREE(untag_ptr(_res));
14974         CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
14975 }
14976
14977 static inline uint64_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
14978         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
14979         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
14980         return tag_ptr(ret_conv, true);
14981 }
14982 int64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
14983         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
14984         int64_t ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
14985         return ret_conv;
14986 }
14987
14988 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
14989         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
14990         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
14991         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
14992         return tag_ptr(ret_conv, true);
14993 }
14994
14995 void  __attribute__((export_name("TS_CVec_PaymentPreimageZ_free"))) TS_CVec_PaymentPreimageZ_free(ptrArray _res) {
14996         LDKCVec_PaymentPreimageZ _res_constr;
14997         _res_constr.datalen = _res->arr_len;
14998         if (_res_constr.datalen > 0)
14999                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
15000         else
15001                 _res_constr.data = NULL;
15002         int8_tArray* _res_vals = (void*) _res->elems;
15003         for (size_t m = 0; m < _res_constr.datalen; m++) {
15004                 int8_tArray _res_conv_12 = _res_vals[m];
15005                 LDKThirtyTwoBytes _res_conv_12_ref;
15006                 CHECK(_res_conv_12->arr_len == 32);
15007                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32); FREE(_res_conv_12);
15008                 _res_constr.data[m] = _res_conv_12_ref;
15009         }
15010         FREE(_res);
15011         CVec_PaymentPreimageZ_free(_res_constr);
15012 }
15013
15014 static inline uint64_t C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR arg) {
15015         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
15016         *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(arg);
15017         return tag_ptr(ret_conv, true);
15018 }
15019 int64_t  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_clone_ptr"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(uint64_t arg) {
15020         LDKC2Tuple_SignatureCVec_SignatureZZ* arg_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(arg);
15021         int64_t ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(arg_conv);
15022         return ret_conv;
15023 }
15024
15025 uint64_t  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_clone"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone(uint64_t orig) {
15026         LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(orig);
15027         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
15028         *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
15029         return tag_ptr(ret_conv, true);
15030 }
15031
15032 uint64_t  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_new"))) TS_C2Tuple_SignatureCVec_SignatureZZ_new(int8_tArray a, ptrArray b) {
15033         LDKSignature a_ref;
15034         CHECK(a->arr_len == 64);
15035         memcpy(a_ref.compact_form, a->elems, 64); FREE(a);
15036         LDKCVec_SignatureZ b_constr;
15037         b_constr.datalen = b->arr_len;
15038         if (b_constr.datalen > 0)
15039                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
15040         else
15041                 b_constr.data = NULL;
15042         int8_tArray* b_vals = (void*) b->elems;
15043         for (size_t m = 0; m < b_constr.datalen; m++) {
15044                 int8_tArray b_conv_12 = b_vals[m];
15045                 LDKSignature b_conv_12_ref;
15046                 CHECK(b_conv_12->arr_len == 64);
15047                 memcpy(b_conv_12_ref.compact_form, b_conv_12->elems, 64); FREE(b_conv_12);
15048                 b_constr.data[m] = b_conv_12_ref;
15049         }
15050         FREE(b);
15051         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
15052         *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
15053         return tag_ptr(ret_conv, true);
15054 }
15055
15056 void  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_free"))) TS_C2Tuple_SignatureCVec_SignatureZZ_free(uint64_t _res) {
15057         if (!ptr_is_owned(_res)) return;
15058         void* _res_ptr = untag_ptr(_res);
15059         CHECK_ACCESS(_res_ptr);
15060         LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(_res_ptr);
15061         FREE(untag_ptr(_res));
15062         C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
15063 }
15064
15065 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(uint64_t o) {
15066         void* o_ptr = untag_ptr(o);
15067         CHECK_ACCESS(o_ptr);
15068         LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(o_ptr);
15069         o_conv = C2Tuple_SignatureCVec_SignatureZZ_clone((LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(o));
15070         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
15071         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
15072         return tag_ptr(ret_conv, true);
15073 }
15074
15075 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() {
15076         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
15077         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
15078         return tag_ptr(ret_conv, true);
15079 }
15080
15081 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(uint64_t o) {
15082         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(o);
15083         jboolean ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o_conv);
15084         return ret_conv;
15085 }
15086
15087 void  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(uint64_t _res) {
15088         if (!ptr_is_owned(_res)) return;
15089         void* _res_ptr = untag_ptr(_res);
15090         CHECK_ACCESS(_res_ptr);
15091         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(_res_ptr);
15092         FREE(untag_ptr(_res));
15093         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
15094 }
15095
15096 static inline uint64_t CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR arg) {
15097         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
15098         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(arg);
15099         return tag_ptr(ret_conv, true);
15100 }
15101 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(uint64_t arg) {
15102         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(arg);
15103         int64_t ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(arg_conv);
15104         return ret_conv;
15105 }
15106
15107 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(uint64_t orig) {
15108         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(orig);
15109         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
15110         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
15111         return tag_ptr(ret_conv, true);
15112 }
15113
15114 uint64_t  __attribute__((export_name("TS_CResult_SignatureNoneZ_ok"))) TS_CResult_SignatureNoneZ_ok(int8_tArray o) {
15115         LDKSignature o_ref;
15116         CHECK(o->arr_len == 64);
15117         memcpy(o_ref.compact_form, o->elems, 64); FREE(o);
15118         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
15119         *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
15120         return tag_ptr(ret_conv, true);
15121 }
15122
15123 uint64_t  __attribute__((export_name("TS_CResult_SignatureNoneZ_err"))) TS_CResult_SignatureNoneZ_err() {
15124         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
15125         *ret_conv = CResult_SignatureNoneZ_err();
15126         return tag_ptr(ret_conv, true);
15127 }
15128
15129 jboolean  __attribute__((export_name("TS_CResult_SignatureNoneZ_is_ok"))) TS_CResult_SignatureNoneZ_is_ok(uint64_t o) {
15130         LDKCResult_SignatureNoneZ* o_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(o);
15131         jboolean ret_conv = CResult_SignatureNoneZ_is_ok(o_conv);
15132         return ret_conv;
15133 }
15134
15135 void  __attribute__((export_name("TS_CResult_SignatureNoneZ_free"))) TS_CResult_SignatureNoneZ_free(uint64_t _res) {
15136         if (!ptr_is_owned(_res)) return;
15137         void* _res_ptr = untag_ptr(_res);
15138         CHECK_ACCESS(_res_ptr);
15139         LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(_res_ptr);
15140         FREE(untag_ptr(_res));
15141         CResult_SignatureNoneZ_free(_res_conv);
15142 }
15143
15144 static inline uint64_t CResult_SignatureNoneZ_clone_ptr(LDKCResult_SignatureNoneZ *NONNULL_PTR arg) {
15145         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
15146         *ret_conv = CResult_SignatureNoneZ_clone(arg);
15147         return tag_ptr(ret_conv, true);
15148 }
15149 int64_t  __attribute__((export_name("TS_CResult_SignatureNoneZ_clone_ptr"))) TS_CResult_SignatureNoneZ_clone_ptr(uint64_t arg) {
15150         LDKCResult_SignatureNoneZ* arg_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(arg);
15151         int64_t ret_conv = CResult_SignatureNoneZ_clone_ptr(arg_conv);
15152         return ret_conv;
15153 }
15154
15155 uint64_t  __attribute__((export_name("TS_CResult_SignatureNoneZ_clone"))) TS_CResult_SignatureNoneZ_clone(uint64_t orig) {
15156         LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(orig);
15157         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
15158         *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
15159         return tag_ptr(ret_conv, true);
15160 }
15161
15162 static inline uint64_t C2Tuple_SignatureSignatureZ_clone_ptr(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR arg) {
15163         LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
15164         *ret_conv = C2Tuple_SignatureSignatureZ_clone(arg);
15165         return tag_ptr(ret_conv, true);
15166 }
15167 int64_t  __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_clone_ptr"))) TS_C2Tuple_SignatureSignatureZ_clone_ptr(uint64_t arg) {
15168         LDKC2Tuple_SignatureSignatureZ* arg_conv = (LDKC2Tuple_SignatureSignatureZ*)untag_ptr(arg);
15169         int64_t ret_conv = C2Tuple_SignatureSignatureZ_clone_ptr(arg_conv);
15170         return ret_conv;
15171 }
15172
15173 uint64_t  __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_clone"))) TS_C2Tuple_SignatureSignatureZ_clone(uint64_t orig) {
15174         LDKC2Tuple_SignatureSignatureZ* orig_conv = (LDKC2Tuple_SignatureSignatureZ*)untag_ptr(orig);
15175         LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
15176         *ret_conv = C2Tuple_SignatureSignatureZ_clone(orig_conv);
15177         return tag_ptr(ret_conv, true);
15178 }
15179
15180 uint64_t  __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_new"))) TS_C2Tuple_SignatureSignatureZ_new(int8_tArray a, int8_tArray b) {
15181         LDKSignature a_ref;
15182         CHECK(a->arr_len == 64);
15183         memcpy(a_ref.compact_form, a->elems, 64); FREE(a);
15184         LDKSignature b_ref;
15185         CHECK(b->arr_len == 64);
15186         memcpy(b_ref.compact_form, b->elems, 64); FREE(b);
15187         LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
15188         *ret_conv = C2Tuple_SignatureSignatureZ_new(a_ref, b_ref);
15189         return tag_ptr(ret_conv, true);
15190 }
15191
15192 void  __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_free"))) TS_C2Tuple_SignatureSignatureZ_free(uint64_t _res) {
15193         if (!ptr_is_owned(_res)) return;
15194         void* _res_ptr = untag_ptr(_res);
15195         CHECK_ACCESS(_res_ptr);
15196         LDKC2Tuple_SignatureSignatureZ _res_conv = *(LDKC2Tuple_SignatureSignatureZ*)(_res_ptr);
15197         FREE(untag_ptr(_res));
15198         C2Tuple_SignatureSignatureZ_free(_res_conv);
15199 }
15200
15201 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_ok"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_ok(uint64_t o) {
15202         void* o_ptr = untag_ptr(o);
15203         CHECK_ACCESS(o_ptr);
15204         LDKC2Tuple_SignatureSignatureZ o_conv = *(LDKC2Tuple_SignatureSignatureZ*)(o_ptr);
15205         o_conv = C2Tuple_SignatureSignatureZ_clone((LDKC2Tuple_SignatureSignatureZ*)untag_ptr(o));
15206         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
15207         *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_ok(o_conv);
15208         return tag_ptr(ret_conv, true);
15209 }
15210
15211 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_err"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_err() {
15212         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
15213         *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_err();
15214         return tag_ptr(ret_conv, true);
15215 }
15216
15217 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(uint64_t o) {
15218         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(o);
15219         jboolean ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(o_conv);
15220         return ret_conv;
15221 }
15222
15223 void  __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_free"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_free(uint64_t _res) {
15224         if (!ptr_is_owned(_res)) return;
15225         void* _res_ptr = untag_ptr(_res);
15226         CHECK_ACCESS(_res_ptr);
15227         LDKCResult_C2Tuple_SignatureSignatureZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(_res_ptr);
15228         FREE(untag_ptr(_res));
15229         CResult_C2Tuple_SignatureSignatureZNoneZ_free(_res_conv);
15230 }
15231
15232 static inline uint64_t CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR arg) {
15233         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
15234         *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone(arg);
15235         return tag_ptr(ret_conv, true);
15236 }
15237 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(uint64_t arg) {
15238         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(arg);
15239         int64_t ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(arg_conv);
15240         return ret_conv;
15241 }
15242
15243 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_clone"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_clone(uint64_t orig) {
15244         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(orig);
15245         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
15246         *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone(orig_conv);
15247         return tag_ptr(ret_conv, true);
15248 }
15249
15250 uint64_t  __attribute__((export_name("TS_CResult_SecretKeyNoneZ_ok"))) TS_CResult_SecretKeyNoneZ_ok(int8_tArray o) {
15251         LDKSecretKey o_ref;
15252         CHECK(o->arr_len == 32);
15253         memcpy(o_ref.bytes, o->elems, 32); FREE(o);
15254         LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
15255         *ret_conv = CResult_SecretKeyNoneZ_ok(o_ref);
15256         return tag_ptr(ret_conv, true);
15257 }
15258
15259 uint64_t  __attribute__((export_name("TS_CResult_SecretKeyNoneZ_err"))) TS_CResult_SecretKeyNoneZ_err() {
15260         LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
15261         *ret_conv = CResult_SecretKeyNoneZ_err();
15262         return tag_ptr(ret_conv, true);
15263 }
15264
15265 jboolean  __attribute__((export_name("TS_CResult_SecretKeyNoneZ_is_ok"))) TS_CResult_SecretKeyNoneZ_is_ok(uint64_t o) {
15266         LDKCResult_SecretKeyNoneZ* o_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(o);
15267         jboolean ret_conv = CResult_SecretKeyNoneZ_is_ok(o_conv);
15268         return ret_conv;
15269 }
15270
15271 void  __attribute__((export_name("TS_CResult_SecretKeyNoneZ_free"))) TS_CResult_SecretKeyNoneZ_free(uint64_t _res) {
15272         if (!ptr_is_owned(_res)) return;
15273         void* _res_ptr = untag_ptr(_res);
15274         CHECK_ACCESS(_res_ptr);
15275         LDKCResult_SecretKeyNoneZ _res_conv = *(LDKCResult_SecretKeyNoneZ*)(_res_ptr);
15276         FREE(untag_ptr(_res));
15277         CResult_SecretKeyNoneZ_free(_res_conv);
15278 }
15279
15280 static inline uint64_t CResult_SecretKeyNoneZ_clone_ptr(LDKCResult_SecretKeyNoneZ *NONNULL_PTR arg) {
15281         LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
15282         *ret_conv = CResult_SecretKeyNoneZ_clone(arg);
15283         return tag_ptr(ret_conv, true);
15284 }
15285 int64_t  __attribute__((export_name("TS_CResult_SecretKeyNoneZ_clone_ptr"))) TS_CResult_SecretKeyNoneZ_clone_ptr(uint64_t arg) {
15286         LDKCResult_SecretKeyNoneZ* arg_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(arg);
15287         int64_t ret_conv = CResult_SecretKeyNoneZ_clone_ptr(arg_conv);
15288         return ret_conv;
15289 }
15290
15291 uint64_t  __attribute__((export_name("TS_CResult_SecretKeyNoneZ_clone"))) TS_CResult_SecretKeyNoneZ_clone(uint64_t orig) {
15292         LDKCResult_SecretKeyNoneZ* orig_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(orig);
15293         LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
15294         *ret_conv = CResult_SecretKeyNoneZ_clone(orig_conv);
15295         return tag_ptr(ret_conv, true);
15296 }
15297
15298 uint64_t  __attribute__((export_name("TS_COption_ScalarZ_some"))) TS_COption_ScalarZ_some(uint64_t o) {
15299         void* o_ptr = untag_ptr(o);
15300         CHECK_ACCESS(o_ptr);
15301         LDKBigEndianScalar o_conv = *(LDKBigEndianScalar*)(o_ptr);
15302         // WARNING: we may need a move here but no clone is available for LDKBigEndianScalar
15303         LDKCOption_ScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ");
15304         *ret_copy = COption_ScalarZ_some(o_conv);
15305         uint64_t ret_ref = tag_ptr(ret_copy, true);
15306         return ret_ref;
15307 }
15308
15309 uint64_t  __attribute__((export_name("TS_COption_ScalarZ_none"))) TS_COption_ScalarZ_none() {
15310         LDKCOption_ScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ");
15311         *ret_copy = COption_ScalarZ_none();
15312         uint64_t ret_ref = tag_ptr(ret_copy, true);
15313         return ret_ref;
15314 }
15315
15316 void  __attribute__((export_name("TS_COption_ScalarZ_free"))) TS_COption_ScalarZ_free(uint64_t _res) {
15317         if (!ptr_is_owned(_res)) return;
15318         void* _res_ptr = untag_ptr(_res);
15319         CHECK_ACCESS(_res_ptr);
15320         LDKCOption_ScalarZ _res_conv = *(LDKCOption_ScalarZ*)(_res_ptr);
15321         FREE(untag_ptr(_res));
15322         COption_ScalarZ_free(_res_conv);
15323 }
15324
15325 uint64_t  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_ok"))) TS_CResult_SharedSecretNoneZ_ok(int8_tArray o) {
15326         LDKThirtyTwoBytes o_ref;
15327         CHECK(o->arr_len == 32);
15328         memcpy(o_ref.data, o->elems, 32); FREE(o);
15329         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
15330         *ret_conv = CResult_SharedSecretNoneZ_ok(o_ref);
15331         return tag_ptr(ret_conv, true);
15332 }
15333
15334 uint64_t  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_err"))) TS_CResult_SharedSecretNoneZ_err() {
15335         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
15336         *ret_conv = CResult_SharedSecretNoneZ_err();
15337         return tag_ptr(ret_conv, true);
15338 }
15339
15340 jboolean  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_is_ok"))) TS_CResult_SharedSecretNoneZ_is_ok(uint64_t o) {
15341         LDKCResult_SharedSecretNoneZ* o_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(o);
15342         jboolean ret_conv = CResult_SharedSecretNoneZ_is_ok(o_conv);
15343         return ret_conv;
15344 }
15345
15346 void  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_free"))) TS_CResult_SharedSecretNoneZ_free(uint64_t _res) {
15347         if (!ptr_is_owned(_res)) return;
15348         void* _res_ptr = untag_ptr(_res);
15349         CHECK_ACCESS(_res_ptr);
15350         LDKCResult_SharedSecretNoneZ _res_conv = *(LDKCResult_SharedSecretNoneZ*)(_res_ptr);
15351         FREE(untag_ptr(_res));
15352         CResult_SharedSecretNoneZ_free(_res_conv);
15353 }
15354
15355 static inline uint64_t CResult_SharedSecretNoneZ_clone_ptr(LDKCResult_SharedSecretNoneZ *NONNULL_PTR arg) {
15356         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
15357         *ret_conv = CResult_SharedSecretNoneZ_clone(arg);
15358         return tag_ptr(ret_conv, true);
15359 }
15360 int64_t  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_clone_ptr"))) TS_CResult_SharedSecretNoneZ_clone_ptr(uint64_t arg) {
15361         LDKCResult_SharedSecretNoneZ* arg_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(arg);
15362         int64_t ret_conv = CResult_SharedSecretNoneZ_clone_ptr(arg_conv);
15363         return ret_conv;
15364 }
15365
15366 uint64_t  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_clone"))) TS_CResult_SharedSecretNoneZ_clone(uint64_t orig) {
15367         LDKCResult_SharedSecretNoneZ* orig_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(orig);
15368         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
15369         *ret_conv = CResult_SharedSecretNoneZ_clone(orig_conv);
15370         return tag_ptr(ret_conv, true);
15371 }
15372
15373 uint64_t  __attribute__((export_name("TS_CResult_SignDecodeErrorZ_ok"))) TS_CResult_SignDecodeErrorZ_ok(uint64_t o) {
15374         void* o_ptr = untag_ptr(o);
15375         CHECK_ACCESS(o_ptr);
15376         LDKSign o_conv = *(LDKSign*)(o_ptr);
15377         if (o_conv.free == LDKSign_JCalls_free) {
15378                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15379                 LDKSign_JCalls_cloned(&o_conv);
15380         }
15381         LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
15382         *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
15383         return tag_ptr(ret_conv, true);
15384 }
15385
15386 uint64_t  __attribute__((export_name("TS_CResult_SignDecodeErrorZ_err"))) TS_CResult_SignDecodeErrorZ_err(uint64_t e) {
15387         LDKDecodeError e_conv;
15388         e_conv.inner = untag_ptr(e);
15389         e_conv.is_owned = ptr_is_owned(e);
15390         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15391         e_conv = DecodeError_clone(&e_conv);
15392         LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
15393         *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
15394         return tag_ptr(ret_conv, true);
15395 }
15396
15397 jboolean  __attribute__((export_name("TS_CResult_SignDecodeErrorZ_is_ok"))) TS_CResult_SignDecodeErrorZ_is_ok(uint64_t o) {
15398         LDKCResult_SignDecodeErrorZ* o_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(o);
15399         jboolean ret_conv = CResult_SignDecodeErrorZ_is_ok(o_conv);
15400         return ret_conv;
15401 }
15402
15403 void  __attribute__((export_name("TS_CResult_SignDecodeErrorZ_free"))) TS_CResult_SignDecodeErrorZ_free(uint64_t _res) {
15404         if (!ptr_is_owned(_res)) return;
15405         void* _res_ptr = untag_ptr(_res);
15406         CHECK_ACCESS(_res_ptr);
15407         LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(_res_ptr);
15408         FREE(untag_ptr(_res));
15409         CResult_SignDecodeErrorZ_free(_res_conv);
15410 }
15411
15412 static inline uint64_t CResult_SignDecodeErrorZ_clone_ptr(LDKCResult_SignDecodeErrorZ *NONNULL_PTR arg) {
15413         LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
15414         *ret_conv = CResult_SignDecodeErrorZ_clone(arg);
15415         return tag_ptr(ret_conv, true);
15416 }
15417 int64_t  __attribute__((export_name("TS_CResult_SignDecodeErrorZ_clone_ptr"))) TS_CResult_SignDecodeErrorZ_clone_ptr(uint64_t arg) {
15418         LDKCResult_SignDecodeErrorZ* arg_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(arg);
15419         int64_t ret_conv = CResult_SignDecodeErrorZ_clone_ptr(arg_conv);
15420         return ret_conv;
15421 }
15422
15423 uint64_t  __attribute__((export_name("TS_CResult_SignDecodeErrorZ_clone"))) TS_CResult_SignDecodeErrorZ_clone(uint64_t orig) {
15424         LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(orig);
15425         LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
15426         *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
15427         return tag_ptr(ret_conv, true);
15428 }
15429
15430 void  __attribute__((export_name("TS_CVec_u5Z_free"))) TS_CVec_u5Z_free(ptrArray _res) {
15431         LDKCVec_u5Z _res_constr;
15432         _res_constr.datalen = _res->arr_len;
15433         if (_res_constr.datalen > 0)
15434                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
15435         else
15436                 _res_constr.data = NULL;
15437         int8_t* _res_vals = (void*) _res->elems;
15438         for (size_t h = 0; h < _res_constr.datalen; h++) {
15439                 int8_t _res_conv_7 = _res_vals[h];
15440                 
15441                 _res_constr.data[h] = (LDKu5){ ._0 = _res_conv_7 };
15442         }
15443         FREE(_res);
15444         CVec_u5Z_free(_res_constr);
15445 }
15446
15447 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_ok"))) TS_CResult_RecoverableSignatureNoneZ_ok(int8_tArray o) {
15448         LDKRecoverableSignature o_ref;
15449         CHECK(o->arr_len == 68);
15450         memcpy(o_ref.serialized_form, o->elems, 68); FREE(o);
15451         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
15452         *ret_conv = CResult_RecoverableSignatureNoneZ_ok(o_ref);
15453         return tag_ptr(ret_conv, true);
15454 }
15455
15456 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_err"))) TS_CResult_RecoverableSignatureNoneZ_err() {
15457         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
15458         *ret_conv = CResult_RecoverableSignatureNoneZ_err();
15459         return tag_ptr(ret_conv, true);
15460 }
15461
15462 jboolean  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_is_ok"))) TS_CResult_RecoverableSignatureNoneZ_is_ok(uint64_t o) {
15463         LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(o);
15464         jboolean ret_conv = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
15465         return ret_conv;
15466 }
15467
15468 void  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_free"))) TS_CResult_RecoverableSignatureNoneZ_free(uint64_t _res) {
15469         if (!ptr_is_owned(_res)) return;
15470         void* _res_ptr = untag_ptr(_res);
15471         CHECK_ACCESS(_res_ptr);
15472         LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
15473         FREE(untag_ptr(_res));
15474         CResult_RecoverableSignatureNoneZ_free(_res_conv);
15475 }
15476
15477 static inline uint64_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
15478         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
15479         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
15480         return tag_ptr(ret_conv, true);
15481 }
15482 int64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone_ptr"))) TS_CResult_RecoverableSignatureNoneZ_clone_ptr(uint64_t arg) {
15483         LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(arg);
15484         int64_t ret_conv = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
15485         return ret_conv;
15486 }
15487
15488 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone"))) TS_CResult_RecoverableSignatureNoneZ_clone(uint64_t orig) {
15489         LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(orig);
15490         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
15491         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
15492         return tag_ptr(ret_conv, true);
15493 }
15494
15495 void  __attribute__((export_name("TS_CVec_u8Z_free"))) TS_CVec_u8Z_free(int8_tArray _res) {
15496         LDKCVec_u8Z _res_ref;
15497         _res_ref.datalen = _res->arr_len;
15498         _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
15499         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
15500         CVec_u8Z_free(_res_ref);
15501 }
15502
15503 void  __attribute__((export_name("TS_CVec_CVec_u8ZZ_free"))) TS_CVec_CVec_u8ZZ_free(ptrArray _res) {
15504         LDKCVec_CVec_u8ZZ _res_constr;
15505         _res_constr.datalen = _res->arr_len;
15506         if (_res_constr.datalen > 0)
15507                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
15508         else
15509                 _res_constr.data = NULL;
15510         int8_tArray* _res_vals = (void*) _res->elems;
15511         for (size_t m = 0; m < _res_constr.datalen; m++) {
15512                 int8_tArray _res_conv_12 = _res_vals[m];
15513                 LDKCVec_u8Z _res_conv_12_ref;
15514                 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
15515                 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
15516                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
15517                 _res_constr.data[m] = _res_conv_12_ref;
15518         }
15519         FREE(_res);
15520         CVec_CVec_u8ZZ_free(_res_constr);
15521 }
15522
15523 uint64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_ok(ptrArray o) {
15524         LDKCVec_CVec_u8ZZ o_constr;
15525         o_constr.datalen = o->arr_len;
15526         if (o_constr.datalen > 0)
15527                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
15528         else
15529                 o_constr.data = NULL;
15530         int8_tArray* o_vals = (void*) o->elems;
15531         for (size_t m = 0; m < o_constr.datalen; m++) {
15532                 int8_tArray o_conv_12 = o_vals[m];
15533                 LDKCVec_u8Z o_conv_12_ref;
15534                 o_conv_12_ref.datalen = o_conv_12->arr_len;
15535                 o_conv_12_ref.data = MALLOC(o_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
15536                 memcpy(o_conv_12_ref.data, o_conv_12->elems, o_conv_12_ref.datalen); FREE(o_conv_12);
15537                 o_constr.data[m] = o_conv_12_ref;
15538         }
15539         FREE(o);
15540         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
15541         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
15542         return tag_ptr(ret_conv, true);
15543 }
15544
15545 uint64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_err"))) TS_CResult_CVec_CVec_u8ZZNoneZ_err() {
15546         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
15547         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
15548         return tag_ptr(ret_conv, true);
15549 }
15550
15551 jboolean  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_is_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_is_ok(uint64_t o) {
15552         LDKCResult_CVec_CVec_u8ZZNoneZ* o_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(o);
15553         jboolean ret_conv = CResult_CVec_CVec_u8ZZNoneZ_is_ok(o_conv);
15554         return ret_conv;
15555 }
15556
15557 void  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_free"))) TS_CResult_CVec_CVec_u8ZZNoneZ_free(uint64_t _res) {
15558         if (!ptr_is_owned(_res)) return;
15559         void* _res_ptr = untag_ptr(_res);
15560         CHECK_ACCESS(_res_ptr);
15561         LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(_res_ptr);
15562         FREE(untag_ptr(_res));
15563         CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
15564 }
15565
15566 static inline uint64_t CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR arg) {
15567         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
15568         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(arg);
15569         return tag_ptr(ret_conv, true);
15570 }
15571 int64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_clone_ptr"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(uint64_t arg) {
15572         LDKCResult_CVec_CVec_u8ZZNoneZ* arg_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(arg);
15573         int64_t ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(arg_conv);
15574         return ret_conv;
15575 }
15576
15577 uint64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_clone"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone(uint64_t orig) {
15578         LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(orig);
15579         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
15580         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
15581         return tag_ptr(ret_conv, true);
15582 }
15583
15584 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_ok(uint64_t o) {
15585         LDKInMemorySigner o_conv;
15586         o_conv.inner = untag_ptr(o);
15587         o_conv.is_owned = ptr_is_owned(o);
15588         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15589         o_conv = InMemorySigner_clone(&o_conv);
15590         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
15591         *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
15592         return tag_ptr(ret_conv, true);
15593 }
15594
15595 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_err"))) TS_CResult_InMemorySignerDecodeErrorZ_err(uint64_t e) {
15596         LDKDecodeError e_conv;
15597         e_conv.inner = untag_ptr(e);
15598         e_conv.is_owned = ptr_is_owned(e);
15599         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15600         e_conv = DecodeError_clone(&e_conv);
15601         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
15602         *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
15603         return tag_ptr(ret_conv, true);
15604 }
15605
15606 jboolean  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_is_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_is_ok(uint64_t o) {
15607         LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(o);
15608         jboolean ret_conv = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
15609         return ret_conv;
15610 }
15611
15612 void  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_free"))) TS_CResult_InMemorySignerDecodeErrorZ_free(uint64_t _res) {
15613         if (!ptr_is_owned(_res)) return;
15614         void* _res_ptr = untag_ptr(_res);
15615         CHECK_ACCESS(_res_ptr);
15616         LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
15617         FREE(untag_ptr(_res));
15618         CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
15619 }
15620
15621 static inline uint64_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
15622         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
15623         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
15624         return tag_ptr(ret_conv, true);
15625 }
15626 int64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr"))) TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr(uint64_t arg) {
15627         LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(arg);
15628         int64_t ret_conv = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
15629         return ret_conv;
15630 }
15631
15632 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone"))) TS_CResult_InMemorySignerDecodeErrorZ_clone(uint64_t orig) {
15633         LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(orig);
15634         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
15635         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
15636         return tag_ptr(ret_conv, true);
15637 }
15638
15639 void  __attribute__((export_name("TS_CVec_TxOutZ_free"))) TS_CVec_TxOutZ_free(uint64_tArray _res) {
15640         LDKCVec_TxOutZ _res_constr;
15641         _res_constr.datalen = _res->arr_len;
15642         if (_res_constr.datalen > 0)
15643                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
15644         else
15645                 _res_constr.data = NULL;
15646         uint64_t* _res_vals = _res->elems;
15647         for (size_t h = 0; h < _res_constr.datalen; h++) {
15648                 uint64_t _res_conv_7 = _res_vals[h];
15649                 void* _res_conv_7_ptr = untag_ptr(_res_conv_7);
15650                 CHECK_ACCESS(_res_conv_7_ptr);
15651                 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
15652                 FREE(untag_ptr(_res_conv_7));
15653                 _res_constr.data[h] = _res_conv_7_conv;
15654         }
15655         FREE(_res);
15656         CVec_TxOutZ_free(_res_constr);
15657 }
15658
15659 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_ok"))) TS_CResult_TransactionNoneZ_ok(int8_tArray o) {
15660         LDKTransaction o_ref;
15661         o_ref.datalen = o->arr_len;
15662         o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
15663         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
15664         o_ref.data_is_owned = true;
15665         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
15666         *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
15667         return tag_ptr(ret_conv, true);
15668 }
15669
15670 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_err"))) TS_CResult_TransactionNoneZ_err() {
15671         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
15672         *ret_conv = CResult_TransactionNoneZ_err();
15673         return tag_ptr(ret_conv, true);
15674 }
15675
15676 jboolean  __attribute__((export_name("TS_CResult_TransactionNoneZ_is_ok"))) TS_CResult_TransactionNoneZ_is_ok(uint64_t o) {
15677         LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(o);
15678         jboolean ret_conv = CResult_TransactionNoneZ_is_ok(o_conv);
15679         return ret_conv;
15680 }
15681
15682 void  __attribute__((export_name("TS_CResult_TransactionNoneZ_free"))) TS_CResult_TransactionNoneZ_free(uint64_t _res) {
15683         if (!ptr_is_owned(_res)) return;
15684         void* _res_ptr = untag_ptr(_res);
15685         CHECK_ACCESS(_res_ptr);
15686         LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
15687         FREE(untag_ptr(_res));
15688         CResult_TransactionNoneZ_free(_res_conv);
15689 }
15690
15691 static inline uint64_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
15692         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
15693         *ret_conv = CResult_TransactionNoneZ_clone(arg);
15694         return tag_ptr(ret_conv, true);
15695 }
15696 int64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_clone_ptr"))) TS_CResult_TransactionNoneZ_clone_ptr(uint64_t arg) {
15697         LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(arg);
15698         int64_t ret_conv = CResult_TransactionNoneZ_clone_ptr(arg_conv);
15699         return ret_conv;
15700 }
15701
15702 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_clone"))) TS_CResult_TransactionNoneZ_clone(uint64_t orig) {
15703         LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(orig);
15704         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
15705         *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
15706         return tag_ptr(ret_conv, true);
15707 }
15708
15709 uint64_t  __attribute__((export_name("TS_COption_u16Z_some"))) TS_COption_u16Z_some(int16_t o) {
15710         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
15711         *ret_copy = COption_u16Z_some(o);
15712         uint64_t ret_ref = tag_ptr(ret_copy, true);
15713         return ret_ref;
15714 }
15715
15716 uint64_t  __attribute__((export_name("TS_COption_u16Z_none"))) TS_COption_u16Z_none() {
15717         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
15718         *ret_copy = COption_u16Z_none();
15719         uint64_t ret_ref = tag_ptr(ret_copy, true);
15720         return ret_ref;
15721 }
15722
15723 void  __attribute__((export_name("TS_COption_u16Z_free"))) TS_COption_u16Z_free(uint64_t _res) {
15724         if (!ptr_is_owned(_res)) return;
15725         void* _res_ptr = untag_ptr(_res);
15726         CHECK_ACCESS(_res_ptr);
15727         LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
15728         FREE(untag_ptr(_res));
15729         COption_u16Z_free(_res_conv);
15730 }
15731
15732 static inline uint64_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
15733         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
15734         *ret_copy = COption_u16Z_clone(arg);
15735         uint64_t ret_ref = tag_ptr(ret_copy, true);
15736         return ret_ref;
15737 }
15738 int64_t  __attribute__((export_name("TS_COption_u16Z_clone_ptr"))) TS_COption_u16Z_clone_ptr(uint64_t arg) {
15739         LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)untag_ptr(arg);
15740         int64_t ret_conv = COption_u16Z_clone_ptr(arg_conv);
15741         return ret_conv;
15742 }
15743
15744 uint64_t  __attribute__((export_name("TS_COption_u16Z_clone"))) TS_COption_u16Z_clone(uint64_t orig) {
15745         LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)untag_ptr(orig);
15746         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
15747         *ret_copy = COption_u16Z_clone(orig_conv);
15748         uint64_t ret_ref = tag_ptr(ret_copy, true);
15749         return ret_ref;
15750 }
15751
15752 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_ok"))) TS_CResult_NoneAPIErrorZ_ok() {
15753         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15754         *ret_conv = CResult_NoneAPIErrorZ_ok();
15755         return tag_ptr(ret_conv, true);
15756 }
15757
15758 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_err"))) TS_CResult_NoneAPIErrorZ_err(uint64_t e) {
15759         void* e_ptr = untag_ptr(e);
15760         CHECK_ACCESS(e_ptr);
15761         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
15762         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
15763         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15764         *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
15765         return tag_ptr(ret_conv, true);
15766 }
15767
15768 jboolean  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_is_ok"))) TS_CResult_NoneAPIErrorZ_is_ok(uint64_t o) {
15769         LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(o);
15770         jboolean ret_conv = CResult_NoneAPIErrorZ_is_ok(o_conv);
15771         return ret_conv;
15772 }
15773
15774 void  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_free"))) TS_CResult_NoneAPIErrorZ_free(uint64_t _res) {
15775         if (!ptr_is_owned(_res)) return;
15776         void* _res_ptr = untag_ptr(_res);
15777         CHECK_ACCESS(_res_ptr);
15778         LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
15779         FREE(untag_ptr(_res));
15780         CResult_NoneAPIErrorZ_free(_res_conv);
15781 }
15782
15783 static inline uint64_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
15784         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15785         *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
15786         return tag_ptr(ret_conv, true);
15787 }
15788 int64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone_ptr"))) TS_CResult_NoneAPIErrorZ_clone_ptr(uint64_t arg) {
15789         LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(arg);
15790         int64_t ret_conv = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
15791         return ret_conv;
15792 }
15793
15794 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone"))) TS_CResult_NoneAPIErrorZ_clone(uint64_t orig) {
15795         LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(orig);
15796         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15797         *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
15798         return tag_ptr(ret_conv, true);
15799 }
15800
15801 void  __attribute__((export_name("TS_CVec_CResult_NoneAPIErrorZZ_free"))) TS_CVec_CResult_NoneAPIErrorZZ_free(uint64_tArray _res) {
15802         LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
15803         _res_constr.datalen = _res->arr_len;
15804         if (_res_constr.datalen > 0)
15805                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
15806         else
15807                 _res_constr.data = NULL;
15808         uint64_t* _res_vals = _res->elems;
15809         for (size_t w = 0; w < _res_constr.datalen; w++) {
15810                 uint64_t _res_conv_22 = _res_vals[w];
15811                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
15812                 CHECK_ACCESS(_res_conv_22_ptr);
15813                 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
15814                 FREE(untag_ptr(_res_conv_22));
15815                 _res_constr.data[w] = _res_conv_22_conv;
15816         }
15817         FREE(_res);
15818         CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
15819 }
15820
15821 void  __attribute__((export_name("TS_CVec_APIErrorZ_free"))) TS_CVec_APIErrorZ_free(uint64_tArray _res) {
15822         LDKCVec_APIErrorZ _res_constr;
15823         _res_constr.datalen = _res->arr_len;
15824         if (_res_constr.datalen > 0)
15825                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
15826         else
15827                 _res_constr.data = NULL;
15828         uint64_t* _res_vals = _res->elems;
15829         for (size_t k = 0; k < _res_constr.datalen; k++) {
15830                 uint64_t _res_conv_10 = _res_vals[k];
15831                 void* _res_conv_10_ptr = untag_ptr(_res_conv_10);
15832                 CHECK_ACCESS(_res_conv_10_ptr);
15833                 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
15834                 FREE(untag_ptr(_res_conv_10));
15835                 _res_constr.data[k] = _res_conv_10_conv;
15836         }
15837         FREE(_res);
15838         CVec_APIErrorZ_free(_res_constr);
15839 }
15840
15841 uint64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_ok"))) TS_CResult__u832APIErrorZ_ok(int8_tArray o) {
15842         LDKThirtyTwoBytes o_ref;
15843         CHECK(o->arr_len == 32);
15844         memcpy(o_ref.data, o->elems, 32); FREE(o);
15845         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
15846         *ret_conv = CResult__u832APIErrorZ_ok(o_ref);
15847         return tag_ptr(ret_conv, true);
15848 }
15849
15850 uint64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_err"))) TS_CResult__u832APIErrorZ_err(uint64_t e) {
15851         void* e_ptr = untag_ptr(e);
15852         CHECK_ACCESS(e_ptr);
15853         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
15854         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
15855         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
15856         *ret_conv = CResult__u832APIErrorZ_err(e_conv);
15857         return tag_ptr(ret_conv, true);
15858 }
15859
15860 jboolean  __attribute__((export_name("TS_CResult__u832APIErrorZ_is_ok"))) TS_CResult__u832APIErrorZ_is_ok(uint64_t o) {
15861         LDKCResult__u832APIErrorZ* o_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(o);
15862         jboolean ret_conv = CResult__u832APIErrorZ_is_ok(o_conv);
15863         return ret_conv;
15864 }
15865
15866 void  __attribute__((export_name("TS_CResult__u832APIErrorZ_free"))) TS_CResult__u832APIErrorZ_free(uint64_t _res) {
15867         if (!ptr_is_owned(_res)) return;
15868         void* _res_ptr = untag_ptr(_res);
15869         CHECK_ACCESS(_res_ptr);
15870         LDKCResult__u832APIErrorZ _res_conv = *(LDKCResult__u832APIErrorZ*)(_res_ptr);
15871         FREE(untag_ptr(_res));
15872         CResult__u832APIErrorZ_free(_res_conv);
15873 }
15874
15875 static inline uint64_t CResult__u832APIErrorZ_clone_ptr(LDKCResult__u832APIErrorZ *NONNULL_PTR arg) {
15876         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
15877         *ret_conv = CResult__u832APIErrorZ_clone(arg);
15878         return tag_ptr(ret_conv, true);
15879 }
15880 int64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_clone_ptr"))) TS_CResult__u832APIErrorZ_clone_ptr(uint64_t arg) {
15881         LDKCResult__u832APIErrorZ* arg_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(arg);
15882         int64_t ret_conv = CResult__u832APIErrorZ_clone_ptr(arg_conv);
15883         return ret_conv;
15884 }
15885
15886 uint64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_clone"))) TS_CResult__u832APIErrorZ_clone(uint64_t orig) {
15887         LDKCResult__u832APIErrorZ* orig_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(orig);
15888         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
15889         *ret_conv = CResult__u832APIErrorZ_clone(orig_conv);
15890         return tag_ptr(ret_conv, true);
15891 }
15892
15893 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_ok"))) TS_CResult_PaymentIdPaymentSendFailureZ_ok(int8_tArray o) {
15894         LDKThirtyTwoBytes o_ref;
15895         CHECK(o->arr_len == 32);
15896         memcpy(o_ref.data, o->elems, 32); FREE(o);
15897         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
15898         *ret_conv = CResult_PaymentIdPaymentSendFailureZ_ok(o_ref);
15899         return tag_ptr(ret_conv, true);
15900 }
15901
15902 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_err"))) TS_CResult_PaymentIdPaymentSendFailureZ_err(uint64_t e) {
15903         void* e_ptr = untag_ptr(e);
15904         CHECK_ACCESS(e_ptr);
15905         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
15906         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
15907         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
15908         *ret_conv = CResult_PaymentIdPaymentSendFailureZ_err(e_conv);
15909         return tag_ptr(ret_conv, true);
15910 }
15911
15912 jboolean  __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_is_ok"))) TS_CResult_PaymentIdPaymentSendFailureZ_is_ok(uint64_t o) {
15913         LDKCResult_PaymentIdPaymentSendFailureZ* o_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)untag_ptr(o);
15914         jboolean ret_conv = CResult_PaymentIdPaymentSendFailureZ_is_ok(o_conv);
15915         return ret_conv;
15916 }
15917
15918 void  __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_free"))) TS_CResult_PaymentIdPaymentSendFailureZ_free(uint64_t _res) {
15919         if (!ptr_is_owned(_res)) return;
15920         void* _res_ptr = untag_ptr(_res);
15921         CHECK_ACCESS(_res_ptr);
15922         LDKCResult_PaymentIdPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(_res_ptr);
15923         FREE(untag_ptr(_res));
15924         CResult_PaymentIdPaymentSendFailureZ_free(_res_conv);
15925 }
15926
15927 static inline uint64_t CResult_PaymentIdPaymentSendFailureZ_clone_ptr(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR arg) {
15928         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
15929         *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(arg);
15930         return tag_ptr(ret_conv, true);
15931 }
15932 int64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_clone_ptr"))) TS_CResult_PaymentIdPaymentSendFailureZ_clone_ptr(uint64_t arg) {
15933         LDKCResult_PaymentIdPaymentSendFailureZ* arg_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)untag_ptr(arg);
15934         int64_t ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone_ptr(arg_conv);
15935         return ret_conv;
15936 }
15937
15938 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_clone"))) TS_CResult_PaymentIdPaymentSendFailureZ_clone(uint64_t orig) {
15939         LDKCResult_PaymentIdPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)untag_ptr(orig);
15940         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
15941         *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(orig_conv);
15942         return tag_ptr(ret_conv, true);
15943 }
15944
15945 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_ok"))) TS_CResult_NonePaymentSendFailureZ_ok() {
15946         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
15947         *ret_conv = CResult_NonePaymentSendFailureZ_ok();
15948         return tag_ptr(ret_conv, true);
15949 }
15950
15951 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_err"))) TS_CResult_NonePaymentSendFailureZ_err(uint64_t e) {
15952         void* e_ptr = untag_ptr(e);
15953         CHECK_ACCESS(e_ptr);
15954         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
15955         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
15956         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
15957         *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
15958         return tag_ptr(ret_conv, true);
15959 }
15960
15961 jboolean  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_is_ok"))) TS_CResult_NonePaymentSendFailureZ_is_ok(uint64_t o) {
15962         LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(o);
15963         jboolean ret_conv = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
15964         return ret_conv;
15965 }
15966
15967 void  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_free"))) TS_CResult_NonePaymentSendFailureZ_free(uint64_t _res) {
15968         if (!ptr_is_owned(_res)) return;
15969         void* _res_ptr = untag_ptr(_res);
15970         CHECK_ACCESS(_res_ptr);
15971         LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
15972         FREE(untag_ptr(_res));
15973         CResult_NonePaymentSendFailureZ_free(_res_conv);
15974 }
15975
15976 static inline uint64_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
15977         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
15978         *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
15979         return tag_ptr(ret_conv, true);
15980 }
15981 int64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone_ptr"))) TS_CResult_NonePaymentSendFailureZ_clone_ptr(uint64_t arg) {
15982         LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(arg);
15983         int64_t ret_conv = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
15984         return ret_conv;
15985 }
15986
15987 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone"))) TS_CResult_NonePaymentSendFailureZ_clone(uint64_t orig) {
15988         LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(orig);
15989         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
15990         *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
15991         return tag_ptr(ret_conv, true);
15992 }
15993
15994 static inline uint64_t C2Tuple_PaymentHashPaymentIdZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR arg) {
15995         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
15996         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(arg);
15997         return tag_ptr(ret_conv, true);
15998 }
15999 int64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_clone_ptr"))) TS_C2Tuple_PaymentHashPaymentIdZ_clone_ptr(uint64_t arg) {
16000         LDKC2Tuple_PaymentHashPaymentIdZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(arg);
16001         int64_t ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone_ptr(arg_conv);
16002         return ret_conv;
16003 }
16004
16005 uint64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_clone"))) TS_C2Tuple_PaymentHashPaymentIdZ_clone(uint64_t orig) {
16006         LDKC2Tuple_PaymentHashPaymentIdZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(orig);
16007         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
16008         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(orig_conv);
16009         return tag_ptr(ret_conv, true);
16010 }
16011
16012 uint64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_new"))) TS_C2Tuple_PaymentHashPaymentIdZ_new(int8_tArray a, int8_tArray b) {
16013         LDKThirtyTwoBytes a_ref;
16014         CHECK(a->arr_len == 32);
16015         memcpy(a_ref.data, a->elems, 32); FREE(a);
16016         LDKThirtyTwoBytes b_ref;
16017         CHECK(b->arr_len == 32);
16018         memcpy(b_ref.data, b->elems, 32); FREE(b);
16019         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
16020         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_new(a_ref, b_ref);
16021         return tag_ptr(ret_conv, true);
16022 }
16023
16024 void  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_free"))) TS_C2Tuple_PaymentHashPaymentIdZ_free(uint64_t _res) {
16025         if (!ptr_is_owned(_res)) return;
16026         void* _res_ptr = untag_ptr(_res);
16027         CHECK_ACCESS(_res_ptr);
16028         LDKC2Tuple_PaymentHashPaymentIdZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(_res_ptr);
16029         FREE(untag_ptr(_res));
16030         C2Tuple_PaymentHashPaymentIdZ_free(_res_conv);
16031 }
16032
16033 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(uint64_t o) {
16034         void* o_ptr = untag_ptr(o);
16035         CHECK_ACCESS(o_ptr);
16036         LDKC2Tuple_PaymentHashPaymentIdZ o_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(o_ptr);
16037         o_conv = C2Tuple_PaymentHashPaymentIdZ_clone((LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(o));
16038         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
16039         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o_conv);
16040         return tag_ptr(ret_conv, true);
16041 }
16042
16043 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(uint64_t e) {
16044         void* e_ptr = untag_ptr(e);
16045         CHECK_ACCESS(e_ptr);
16046         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
16047         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
16048         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
16049         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e_conv);
16050         return tag_ptr(ret_conv, true);
16051 }
16052
16053 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(uint64_t o) {
16054         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(o);
16055         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o_conv);
16056         return ret_conv;
16057 }
16058
16059 void  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(uint64_t _res) {
16060         if (!ptr_is_owned(_res)) return;
16061         void* _res_ptr = untag_ptr(_res);
16062         CHECK_ACCESS(_res_ptr);
16063         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(_res_ptr);
16064         FREE(untag_ptr(_res));
16065         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res_conv);
16066 }
16067
16068 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR arg) {
16069         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
16070         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(arg);
16071         return tag_ptr(ret_conv, true);
16072 }
16073 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(uint64_t arg) {
16074         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(arg);
16075         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(arg_conv);
16076         return ret_conv;
16077 }
16078
16079 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(uint64_t orig) {
16080         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(orig);
16081         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
16082         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig_conv);
16083         return tag_ptr(ret_conv, true);
16084 }
16085
16086 void  __attribute__((export_name("TS_CVec_ThirtyTwoBytesZ_free"))) TS_CVec_ThirtyTwoBytesZ_free(ptrArray _res) {
16087         LDKCVec_ThirtyTwoBytesZ _res_constr;
16088         _res_constr.datalen = _res->arr_len;
16089         if (_res_constr.datalen > 0)
16090                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
16091         else
16092                 _res_constr.data = NULL;
16093         int8_tArray* _res_vals = (void*) _res->elems;
16094         for (size_t m = 0; m < _res_constr.datalen; m++) {
16095                 int8_tArray _res_conv_12 = _res_vals[m];
16096                 LDKThirtyTwoBytes _res_conv_12_ref;
16097                 CHECK(_res_conv_12->arr_len == 32);
16098                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32); FREE(_res_conv_12);
16099                 _res_constr.data[m] = _res_conv_12_ref;
16100         }
16101         FREE(_res);
16102         CVec_ThirtyTwoBytesZ_free(_res_constr);
16103 }
16104
16105 static inline uint64_t C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR arg) {
16106         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
16107         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(arg);
16108         return tag_ptr(ret_conv, true);
16109 }
16110 int64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_clone_ptr"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(uint64_t arg) {
16111         LDKC2Tuple_PaymentHashPaymentSecretZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(arg);
16112         int64_t ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(arg_conv);
16113         return ret_conv;
16114 }
16115
16116 uint64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_clone"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone(uint64_t orig) {
16117         LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(orig);
16118         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
16119         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
16120         return tag_ptr(ret_conv, true);
16121 }
16122
16123 uint64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_new"))) TS_C2Tuple_PaymentHashPaymentSecretZ_new(int8_tArray a, int8_tArray b) {
16124         LDKThirtyTwoBytes a_ref;
16125         CHECK(a->arr_len == 32);
16126         memcpy(a_ref.data, a->elems, 32); FREE(a);
16127         LDKThirtyTwoBytes b_ref;
16128         CHECK(b->arr_len == 32);
16129         memcpy(b_ref.data, b->elems, 32); FREE(b);
16130         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
16131         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
16132         return tag_ptr(ret_conv, true);
16133 }
16134
16135 void  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_free"))) TS_C2Tuple_PaymentHashPaymentSecretZ_free(uint64_t _res) {
16136         if (!ptr_is_owned(_res)) return;
16137         void* _res_ptr = untag_ptr(_res);
16138         CHECK_ACCESS(_res_ptr);
16139         LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(_res_ptr);
16140         FREE(untag_ptr(_res));
16141         C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
16142 }
16143
16144 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(uint64_t o) {
16145         void* o_ptr = untag_ptr(o);
16146         CHECK_ACCESS(o_ptr);
16147         LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
16148         o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(o));
16149         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
16150         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o_conv);
16151         return tag_ptr(ret_conv, true);
16152 }
16153
16154 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() {
16155         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
16156         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err();
16157         return tag_ptr(ret_conv, true);
16158 }
16159
16160 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(uint64_t o) {
16161         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(o);
16162         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o_conv);
16163         return ret_conv;
16164 }
16165
16166 void  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(uint64_t _res) {
16167         if (!ptr_is_owned(_res)) return;
16168         void* _res_ptr = untag_ptr(_res);
16169         CHECK_ACCESS(_res_ptr);
16170         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(_res_ptr);
16171         FREE(untag_ptr(_res));
16172         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res_conv);
16173 }
16174
16175 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR arg) {
16176         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
16177         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(arg);
16178         return tag_ptr(ret_conv, true);
16179 }
16180 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(uint64_t arg) {
16181         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(arg);
16182         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(arg_conv);
16183         return ret_conv;
16184 }
16185
16186 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(uint64_t orig) {
16187         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(orig);
16188         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
16189         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig_conv);
16190         return tag_ptr(ret_conv, true);
16191 }
16192
16193 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(uint64_t o) {
16194         void* o_ptr = untag_ptr(o);
16195         CHECK_ACCESS(o_ptr);
16196         LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
16197         o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(o));
16198         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
16199         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o_conv);
16200         return tag_ptr(ret_conv, true);
16201 }
16202
16203 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(uint64_t e) {
16204         void* e_ptr = untag_ptr(e);
16205         CHECK_ACCESS(e_ptr);
16206         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
16207         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
16208         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
16209         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e_conv);
16210         return tag_ptr(ret_conv, true);
16211 }
16212
16213 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(uint64_t o) {
16214         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(o);
16215         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o_conv);
16216         return ret_conv;
16217 }
16218
16219 void  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(uint64_t _res) {
16220         if (!ptr_is_owned(_res)) return;
16221         void* _res_ptr = untag_ptr(_res);
16222         CHECK_ACCESS(_res_ptr);
16223         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(_res_ptr);
16224         FREE(untag_ptr(_res));
16225         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res_conv);
16226 }
16227
16228 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR arg) {
16229         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
16230         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(arg);
16231         return tag_ptr(ret_conv, true);
16232 }
16233 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(uint64_t arg) {
16234         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(arg);
16235         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(arg_conv);
16236         return ret_conv;
16237 }
16238
16239 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(uint64_t orig) {
16240         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(orig);
16241         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
16242         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig_conv);
16243         return tag_ptr(ret_conv, true);
16244 }
16245
16246 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_ok"))) TS_CResult_PaymentSecretNoneZ_ok(int8_tArray o) {
16247         LDKThirtyTwoBytes o_ref;
16248         CHECK(o->arr_len == 32);
16249         memcpy(o_ref.data, o->elems, 32); FREE(o);
16250         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
16251         *ret_conv = CResult_PaymentSecretNoneZ_ok(o_ref);
16252         return tag_ptr(ret_conv, true);
16253 }
16254
16255 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_err"))) TS_CResult_PaymentSecretNoneZ_err() {
16256         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
16257         *ret_conv = CResult_PaymentSecretNoneZ_err();
16258         return tag_ptr(ret_conv, true);
16259 }
16260
16261 jboolean  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_is_ok"))) TS_CResult_PaymentSecretNoneZ_is_ok(uint64_t o) {
16262         LDKCResult_PaymentSecretNoneZ* o_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(o);
16263         jboolean ret_conv = CResult_PaymentSecretNoneZ_is_ok(o_conv);
16264         return ret_conv;
16265 }
16266
16267 void  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_free"))) TS_CResult_PaymentSecretNoneZ_free(uint64_t _res) {
16268         if (!ptr_is_owned(_res)) return;
16269         void* _res_ptr = untag_ptr(_res);
16270         CHECK_ACCESS(_res_ptr);
16271         LDKCResult_PaymentSecretNoneZ _res_conv = *(LDKCResult_PaymentSecretNoneZ*)(_res_ptr);
16272         FREE(untag_ptr(_res));
16273         CResult_PaymentSecretNoneZ_free(_res_conv);
16274 }
16275
16276 static inline uint64_t CResult_PaymentSecretNoneZ_clone_ptr(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR arg) {
16277         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
16278         *ret_conv = CResult_PaymentSecretNoneZ_clone(arg);
16279         return tag_ptr(ret_conv, true);
16280 }
16281 int64_t  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_clone_ptr"))) TS_CResult_PaymentSecretNoneZ_clone_ptr(uint64_t arg) {
16282         LDKCResult_PaymentSecretNoneZ* arg_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(arg);
16283         int64_t ret_conv = CResult_PaymentSecretNoneZ_clone_ptr(arg_conv);
16284         return ret_conv;
16285 }
16286
16287 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_clone"))) TS_CResult_PaymentSecretNoneZ_clone(uint64_t orig) {
16288         LDKCResult_PaymentSecretNoneZ* orig_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(orig);
16289         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
16290         *ret_conv = CResult_PaymentSecretNoneZ_clone(orig_conv);
16291         return tag_ptr(ret_conv, true);
16292 }
16293
16294 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_ok"))) TS_CResult_PaymentSecretAPIErrorZ_ok(int8_tArray o) {
16295         LDKThirtyTwoBytes o_ref;
16296         CHECK(o->arr_len == 32);
16297         memcpy(o_ref.data, o->elems, 32); FREE(o);
16298         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
16299         *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
16300         return tag_ptr(ret_conv, true);
16301 }
16302
16303 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_err"))) TS_CResult_PaymentSecretAPIErrorZ_err(uint64_t e) {
16304         void* e_ptr = untag_ptr(e);
16305         CHECK_ACCESS(e_ptr);
16306         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
16307         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
16308         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
16309         *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
16310         return tag_ptr(ret_conv, true);
16311 }
16312
16313 jboolean  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_is_ok"))) TS_CResult_PaymentSecretAPIErrorZ_is_ok(uint64_t o) {
16314         LDKCResult_PaymentSecretAPIErrorZ* o_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(o);
16315         jboolean ret_conv = CResult_PaymentSecretAPIErrorZ_is_ok(o_conv);
16316         return ret_conv;
16317 }
16318
16319 void  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_free"))) TS_CResult_PaymentSecretAPIErrorZ_free(uint64_t _res) {
16320         if (!ptr_is_owned(_res)) return;
16321         void* _res_ptr = untag_ptr(_res);
16322         CHECK_ACCESS(_res_ptr);
16323         LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(_res_ptr);
16324         FREE(untag_ptr(_res));
16325         CResult_PaymentSecretAPIErrorZ_free(_res_conv);
16326 }
16327
16328 static inline uint64_t CResult_PaymentSecretAPIErrorZ_clone_ptr(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR arg) {
16329         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
16330         *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(arg);
16331         return tag_ptr(ret_conv, true);
16332 }
16333 int64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_clone_ptr"))) TS_CResult_PaymentSecretAPIErrorZ_clone_ptr(uint64_t arg) {
16334         LDKCResult_PaymentSecretAPIErrorZ* arg_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(arg);
16335         int64_t ret_conv = CResult_PaymentSecretAPIErrorZ_clone_ptr(arg_conv);
16336         return ret_conv;
16337 }
16338
16339 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_clone"))) TS_CResult_PaymentSecretAPIErrorZ_clone(uint64_t orig) {
16340         LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(orig);
16341         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
16342         *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
16343         return tag_ptr(ret_conv, true);
16344 }
16345
16346 uint64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_ok(int8_tArray o) {
16347         LDKThirtyTwoBytes o_ref;
16348         CHECK(o->arr_len == 32);
16349         memcpy(o_ref.data, o->elems, 32); FREE(o);
16350         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
16351         *ret_conv = CResult_PaymentPreimageAPIErrorZ_ok(o_ref);
16352         return tag_ptr(ret_conv, true);
16353 }
16354
16355 uint64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_err"))) TS_CResult_PaymentPreimageAPIErrorZ_err(uint64_t e) {
16356         void* e_ptr = untag_ptr(e);
16357         CHECK_ACCESS(e_ptr);
16358         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
16359         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
16360         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
16361         *ret_conv = CResult_PaymentPreimageAPIErrorZ_err(e_conv);
16362         return tag_ptr(ret_conv, true);
16363 }
16364
16365 jboolean  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_is_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_is_ok(uint64_t o) {
16366         LDKCResult_PaymentPreimageAPIErrorZ* o_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(o);
16367         jboolean ret_conv = CResult_PaymentPreimageAPIErrorZ_is_ok(o_conv);
16368         return ret_conv;
16369 }
16370
16371 void  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_free"))) TS_CResult_PaymentPreimageAPIErrorZ_free(uint64_t _res) {
16372         if (!ptr_is_owned(_res)) return;
16373         void* _res_ptr = untag_ptr(_res);
16374         CHECK_ACCESS(_res_ptr);
16375         LDKCResult_PaymentPreimageAPIErrorZ _res_conv = *(LDKCResult_PaymentPreimageAPIErrorZ*)(_res_ptr);
16376         FREE(untag_ptr(_res));
16377         CResult_PaymentPreimageAPIErrorZ_free(_res_conv);
16378 }
16379
16380 static inline uint64_t CResult_PaymentPreimageAPIErrorZ_clone_ptr(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR arg) {
16381         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
16382         *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(arg);
16383         return tag_ptr(ret_conv, true);
16384 }
16385 int64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_clone_ptr"))) TS_CResult_PaymentPreimageAPIErrorZ_clone_ptr(uint64_t arg) {
16386         LDKCResult_PaymentPreimageAPIErrorZ* arg_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(arg);
16387         int64_t ret_conv = CResult_PaymentPreimageAPIErrorZ_clone_ptr(arg_conv);
16388         return ret_conv;
16389 }
16390
16391 uint64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_clone"))) TS_CResult_PaymentPreimageAPIErrorZ_clone(uint64_t orig) {
16392         LDKCResult_PaymentPreimageAPIErrorZ* orig_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(orig);
16393         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
16394         *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(orig_conv);
16395         return tag_ptr(ret_conv, true);
16396 }
16397
16398 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(uint64_t o) {
16399         LDKCounterpartyForwardingInfo o_conv;
16400         o_conv.inner = untag_ptr(o);
16401         o_conv.is_owned = ptr_is_owned(o);
16402         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16403         o_conv = CounterpartyForwardingInfo_clone(&o_conv);
16404         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
16405         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o_conv);
16406         return tag_ptr(ret_conv, true);
16407 }
16408
16409 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_err"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_err(uint64_t e) {
16410         LDKDecodeError e_conv;
16411         e_conv.inner = untag_ptr(e);
16412         e_conv.is_owned = ptr_is_owned(e);
16413         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16414         e_conv = DecodeError_clone(&e_conv);
16415         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
16416         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e_conv);
16417         return tag_ptr(ret_conv, true);
16418 }
16419
16420 jboolean  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(uint64_t o) {
16421         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* o_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(o);
16422         jboolean ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o_conv);
16423         return ret_conv;
16424 }
16425
16426 void  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_free"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_free(uint64_t _res) {
16427         if (!ptr_is_owned(_res)) return;
16428         void* _res_ptr = untag_ptr(_res);
16429         CHECK_ACCESS(_res_ptr);
16430         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(_res_ptr);
16431         FREE(untag_ptr(_res));
16432         CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res_conv);
16433 }
16434
16435 static inline uint64_t CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR arg) {
16436         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
16437         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(arg);
16438         return tag_ptr(ret_conv, true);
16439 }
16440 int64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
16441         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(arg);
16442         int64_t ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(arg_conv);
16443         return ret_conv;
16444 }
16445
16446 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(uint64_t orig) {
16447         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(orig);
16448         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
16449         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig_conv);
16450         return tag_ptr(ret_conv, true);
16451 }
16452
16453 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_ok(uint64_t o) {
16454         LDKChannelCounterparty o_conv;
16455         o_conv.inner = untag_ptr(o);
16456         o_conv.is_owned = ptr_is_owned(o);
16457         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16458         o_conv = ChannelCounterparty_clone(&o_conv);
16459         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
16460         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_ok(o_conv);
16461         return tag_ptr(ret_conv, true);
16462 }
16463
16464 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_err"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_err(uint64_t e) {
16465         LDKDecodeError e_conv;
16466         e_conv.inner = untag_ptr(e);
16467         e_conv.is_owned = ptr_is_owned(e);
16468         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16469         e_conv = DecodeError_clone(&e_conv);
16470         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
16471         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_err(e_conv);
16472         return tag_ptr(ret_conv, true);
16473 }
16474
16475 jboolean  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_is_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_is_ok(uint64_t o) {
16476         LDKCResult_ChannelCounterpartyDecodeErrorZ* o_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(o);
16477         jboolean ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o_conv);
16478         return ret_conv;
16479 }
16480
16481 void  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_free"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_free(uint64_t _res) {
16482         if (!ptr_is_owned(_res)) return;
16483         void* _res_ptr = untag_ptr(_res);
16484         CHECK_ACCESS(_res_ptr);
16485         LDKCResult_ChannelCounterpartyDecodeErrorZ _res_conv = *(LDKCResult_ChannelCounterpartyDecodeErrorZ*)(_res_ptr);
16486         FREE(untag_ptr(_res));
16487         CResult_ChannelCounterpartyDecodeErrorZ_free(_res_conv);
16488 }
16489
16490 static inline uint64_t CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR arg) {
16491         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
16492         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(arg);
16493         return tag_ptr(ret_conv, true);
16494 }
16495 int64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(uint64_t arg) {
16496         LDKCResult_ChannelCounterpartyDecodeErrorZ* arg_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(arg);
16497         int64_t ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(arg_conv);
16498         return ret_conv;
16499 }
16500
16501 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_clone"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_clone(uint64_t orig) {
16502         LDKCResult_ChannelCounterpartyDecodeErrorZ* orig_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(orig);
16503         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
16504         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(orig_conv);
16505         return tag_ptr(ret_conv, true);
16506 }
16507
16508 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_ok(uint64_t o) {
16509         LDKChannelDetails o_conv;
16510         o_conv.inner = untag_ptr(o);
16511         o_conv.is_owned = ptr_is_owned(o);
16512         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16513         o_conv = ChannelDetails_clone(&o_conv);
16514         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
16515         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_ok(o_conv);
16516         return tag_ptr(ret_conv, true);
16517 }
16518
16519 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_err"))) TS_CResult_ChannelDetailsDecodeErrorZ_err(uint64_t e) {
16520         LDKDecodeError e_conv;
16521         e_conv.inner = untag_ptr(e);
16522         e_conv.is_owned = ptr_is_owned(e);
16523         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16524         e_conv = DecodeError_clone(&e_conv);
16525         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
16526         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_err(e_conv);
16527         return tag_ptr(ret_conv, true);
16528 }
16529
16530 jboolean  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_is_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_is_ok(uint64_t o) {
16531         LDKCResult_ChannelDetailsDecodeErrorZ* o_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(o);
16532         jboolean ret_conv = CResult_ChannelDetailsDecodeErrorZ_is_ok(o_conv);
16533         return ret_conv;
16534 }
16535
16536 void  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_free"))) TS_CResult_ChannelDetailsDecodeErrorZ_free(uint64_t _res) {
16537         if (!ptr_is_owned(_res)) return;
16538         void* _res_ptr = untag_ptr(_res);
16539         CHECK_ACCESS(_res_ptr);
16540         LDKCResult_ChannelDetailsDecodeErrorZ _res_conv = *(LDKCResult_ChannelDetailsDecodeErrorZ*)(_res_ptr);
16541         FREE(untag_ptr(_res));
16542         CResult_ChannelDetailsDecodeErrorZ_free(_res_conv);
16543 }
16544
16545 static inline uint64_t CResult_ChannelDetailsDecodeErrorZ_clone_ptr(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR arg) {
16546         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
16547         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(arg);
16548         return tag_ptr(ret_conv, true);
16549 }
16550 int64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelDetailsDecodeErrorZ_clone_ptr(uint64_t arg) {
16551         LDKCResult_ChannelDetailsDecodeErrorZ* arg_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(arg);
16552         int64_t ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone_ptr(arg_conv);
16553         return ret_conv;
16554 }
16555
16556 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_clone"))) TS_CResult_ChannelDetailsDecodeErrorZ_clone(uint64_t orig) {
16557         LDKCResult_ChannelDetailsDecodeErrorZ* orig_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(orig);
16558         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
16559         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(orig_conv);
16560         return tag_ptr(ret_conv, true);
16561 }
16562
16563 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_ok(uint64_t o) {
16564         LDKPhantomRouteHints o_conv;
16565         o_conv.inner = untag_ptr(o);
16566         o_conv.is_owned = ptr_is_owned(o);
16567         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16568         o_conv = PhantomRouteHints_clone(&o_conv);
16569         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
16570         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_ok(o_conv);
16571         return tag_ptr(ret_conv, true);
16572 }
16573
16574 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_err"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_err(uint64_t e) {
16575         LDKDecodeError e_conv;
16576         e_conv.inner = untag_ptr(e);
16577         e_conv.is_owned = ptr_is_owned(e);
16578         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16579         e_conv = DecodeError_clone(&e_conv);
16580         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
16581         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_err(e_conv);
16582         return tag_ptr(ret_conv, true);
16583 }
16584
16585 jboolean  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_is_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_is_ok(uint64_t o) {
16586         LDKCResult_PhantomRouteHintsDecodeErrorZ* o_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(o);
16587         jboolean ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o_conv);
16588         return ret_conv;
16589 }
16590
16591 void  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_free"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_free(uint64_t _res) {
16592         if (!ptr_is_owned(_res)) return;
16593         void* _res_ptr = untag_ptr(_res);
16594         CHECK_ACCESS(_res_ptr);
16595         LDKCResult_PhantomRouteHintsDecodeErrorZ _res_conv = *(LDKCResult_PhantomRouteHintsDecodeErrorZ*)(_res_ptr);
16596         FREE(untag_ptr(_res));
16597         CResult_PhantomRouteHintsDecodeErrorZ_free(_res_conv);
16598 }
16599
16600 static inline uint64_t CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR arg) {
16601         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
16602         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(arg);
16603         return tag_ptr(ret_conv, true);
16604 }
16605 int64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(uint64_t arg) {
16606         LDKCResult_PhantomRouteHintsDecodeErrorZ* arg_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(arg);
16607         int64_t ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(arg_conv);
16608         return ret_conv;
16609 }
16610
16611 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_clone"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_clone(uint64_t orig) {
16612         LDKCResult_PhantomRouteHintsDecodeErrorZ* orig_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(orig);
16613         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
16614         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(orig_conv);
16615         return tag_ptr(ret_conv, true);
16616 }
16617
16618 void  __attribute__((export_name("TS_CVec_ChannelMonitorZ_free"))) TS_CVec_ChannelMonitorZ_free(uint64_tArray _res) {
16619         LDKCVec_ChannelMonitorZ _res_constr;
16620         _res_constr.datalen = _res->arr_len;
16621         if (_res_constr.datalen > 0)
16622                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
16623         else
16624                 _res_constr.data = NULL;
16625         uint64_t* _res_vals = _res->elems;
16626         for (size_t q = 0; q < _res_constr.datalen; q++) {
16627                 uint64_t _res_conv_16 = _res_vals[q];
16628                 LDKChannelMonitor _res_conv_16_conv;
16629                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
16630                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
16631                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
16632                 _res_constr.data[q] = _res_conv_16_conv;
16633         }
16634         FREE(_res);
16635         CVec_ChannelMonitorZ_free(_res_constr);
16636 }
16637
16638 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_new"))) TS_C2Tuple_BlockHashChannelManagerZ_new(int8_tArray a, uint64_t b) {
16639         LDKThirtyTwoBytes a_ref;
16640         CHECK(a->arr_len == 32);
16641         memcpy(a_ref.data, a->elems, 32); FREE(a);
16642         LDKChannelManager b_conv;
16643         b_conv.inner = untag_ptr(b);
16644         b_conv.is_owned = ptr_is_owned(b);
16645         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
16646         // WARNING: we need a move here but no clone is available for LDKChannelManager
16647         
16648         LDKC2Tuple_BlockHashChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
16649         *ret_conv = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
16650         return tag_ptr(ret_conv, true);
16651 }
16652
16653 void  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_free"))) TS_C2Tuple_BlockHashChannelManagerZ_free(uint64_t _res) {
16654         if (!ptr_is_owned(_res)) return;
16655         void* _res_ptr = untag_ptr(_res);
16656         CHECK_ACCESS(_res_ptr);
16657         LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(_res_ptr);
16658         FREE(untag_ptr(_res));
16659         C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
16660 }
16661
16662 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(uint64_t o) {
16663         void* o_ptr = untag_ptr(o);
16664         CHECK_ACCESS(o_ptr);
16665         LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(o_ptr);
16666         // WARNING: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
16667         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
16668         *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
16669         return tag_ptr(ret_conv, true);
16670 }
16671
16672 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(uint64_t e) {
16673         LDKDecodeError e_conv;
16674         e_conv.inner = untag_ptr(e);
16675         e_conv.is_owned = ptr_is_owned(e);
16676         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16677         e_conv = DecodeError_clone(&e_conv);
16678         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
16679         *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
16680         return tag_ptr(ret_conv, true);
16681 }
16682
16683 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(uint64_t o) {
16684         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(o);
16685         jboolean ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o_conv);
16686         return ret_conv;
16687 }
16688
16689 void  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(uint64_t _res) {
16690         if (!ptr_is_owned(_res)) return;
16691         void* _res_ptr = untag_ptr(_res);
16692         CHECK_ACCESS(_res_ptr);
16693         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(_res_ptr);
16694         FREE(untag_ptr(_res));
16695         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
16696 }
16697
16698 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_ok(uint64_t o) {
16699         LDKChannelConfig o_conv;
16700         o_conv.inner = untag_ptr(o);
16701         o_conv.is_owned = ptr_is_owned(o);
16702         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16703         o_conv = ChannelConfig_clone(&o_conv);
16704         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
16705         *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
16706         return tag_ptr(ret_conv, true);
16707 }
16708
16709 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_err"))) TS_CResult_ChannelConfigDecodeErrorZ_err(uint64_t e) {
16710         LDKDecodeError e_conv;
16711         e_conv.inner = untag_ptr(e);
16712         e_conv.is_owned = ptr_is_owned(e);
16713         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16714         e_conv = DecodeError_clone(&e_conv);
16715         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
16716         *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
16717         return tag_ptr(ret_conv, true);
16718 }
16719
16720 jboolean  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_is_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_is_ok(uint64_t o) {
16721         LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(o);
16722         jboolean ret_conv = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
16723         return ret_conv;
16724 }
16725
16726 void  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_free"))) TS_CResult_ChannelConfigDecodeErrorZ_free(uint64_t _res) {
16727         if (!ptr_is_owned(_res)) return;
16728         void* _res_ptr = untag_ptr(_res);
16729         CHECK_ACCESS(_res_ptr);
16730         LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
16731         FREE(untag_ptr(_res));
16732         CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
16733 }
16734
16735 static inline uint64_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
16736         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
16737         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
16738         return tag_ptr(ret_conv, true);
16739 }
16740 int64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr(uint64_t arg) {
16741         LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(arg);
16742         int64_t ret_conv = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
16743         return ret_conv;
16744 }
16745
16746 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone"))) TS_CResult_ChannelConfigDecodeErrorZ_clone(uint64_t orig) {
16747         LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(orig);
16748         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
16749         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
16750         return tag_ptr(ret_conv, true);
16751 }
16752
16753 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_ok"))) TS_CResult_OutPointDecodeErrorZ_ok(uint64_t o) {
16754         LDKOutPoint o_conv;
16755         o_conv.inner = untag_ptr(o);
16756         o_conv.is_owned = ptr_is_owned(o);
16757         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16758         o_conv = OutPoint_clone(&o_conv);
16759         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
16760         *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
16761         return tag_ptr(ret_conv, true);
16762 }
16763
16764 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_err"))) TS_CResult_OutPointDecodeErrorZ_err(uint64_t e) {
16765         LDKDecodeError e_conv;
16766         e_conv.inner = untag_ptr(e);
16767         e_conv.is_owned = ptr_is_owned(e);
16768         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16769         e_conv = DecodeError_clone(&e_conv);
16770         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
16771         *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
16772         return tag_ptr(ret_conv, true);
16773 }
16774
16775 jboolean  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_is_ok"))) TS_CResult_OutPointDecodeErrorZ_is_ok(uint64_t o) {
16776         LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(o);
16777         jboolean ret_conv = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
16778         return ret_conv;
16779 }
16780
16781 void  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_free"))) TS_CResult_OutPointDecodeErrorZ_free(uint64_t _res) {
16782         if (!ptr_is_owned(_res)) return;
16783         void* _res_ptr = untag_ptr(_res);
16784         CHECK_ACCESS(_res_ptr);
16785         LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
16786         FREE(untag_ptr(_res));
16787         CResult_OutPointDecodeErrorZ_free(_res_conv);
16788 }
16789
16790 static inline uint64_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
16791         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
16792         *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
16793         return tag_ptr(ret_conv, true);
16794 }
16795 int64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone_ptr"))) TS_CResult_OutPointDecodeErrorZ_clone_ptr(uint64_t arg) {
16796         LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(arg);
16797         int64_t ret_conv = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
16798         return ret_conv;
16799 }
16800
16801 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone"))) TS_CResult_OutPointDecodeErrorZ_clone(uint64_t orig) {
16802         LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(orig);
16803         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
16804         *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
16805         return tag_ptr(ret_conv, true);
16806 }
16807
16808 uint64_t  __attribute__((export_name("TS_COption_TypeZ_some"))) TS_COption_TypeZ_some(uint64_t o) {
16809         void* o_ptr = untag_ptr(o);
16810         CHECK_ACCESS(o_ptr);
16811         LDKType o_conv = *(LDKType*)(o_ptr);
16812         if (o_conv.free == LDKType_JCalls_free) {
16813                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16814                 LDKType_JCalls_cloned(&o_conv);
16815         }
16816         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
16817         *ret_copy = COption_TypeZ_some(o_conv);
16818         uint64_t ret_ref = tag_ptr(ret_copy, true);
16819         return ret_ref;
16820 }
16821
16822 uint64_t  __attribute__((export_name("TS_COption_TypeZ_none"))) TS_COption_TypeZ_none() {
16823         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
16824         *ret_copy = COption_TypeZ_none();
16825         uint64_t ret_ref = tag_ptr(ret_copy, true);
16826         return ret_ref;
16827 }
16828
16829 void  __attribute__((export_name("TS_COption_TypeZ_free"))) TS_COption_TypeZ_free(uint64_t _res) {
16830         if (!ptr_is_owned(_res)) return;
16831         void* _res_ptr = untag_ptr(_res);
16832         CHECK_ACCESS(_res_ptr);
16833         LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
16834         FREE(untag_ptr(_res));
16835         COption_TypeZ_free(_res_conv);
16836 }
16837
16838 static inline uint64_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
16839         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
16840         *ret_copy = COption_TypeZ_clone(arg);
16841         uint64_t ret_ref = tag_ptr(ret_copy, true);
16842         return ret_ref;
16843 }
16844 int64_t  __attribute__((export_name("TS_COption_TypeZ_clone_ptr"))) TS_COption_TypeZ_clone_ptr(uint64_t arg) {
16845         LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)untag_ptr(arg);
16846         int64_t ret_conv = COption_TypeZ_clone_ptr(arg_conv);
16847         return ret_conv;
16848 }
16849
16850 uint64_t  __attribute__((export_name("TS_COption_TypeZ_clone"))) TS_COption_TypeZ_clone(uint64_t orig) {
16851         LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)untag_ptr(orig);
16852         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
16853         *ret_copy = COption_TypeZ_clone(orig_conv);
16854         uint64_t ret_ref = tag_ptr(ret_copy, true);
16855         return ret_ref;
16856 }
16857
16858 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_ok(uint64_t o) {
16859         void* o_ptr = untag_ptr(o);
16860         CHECK_ACCESS(o_ptr);
16861         LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
16862         o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)untag_ptr(o));
16863         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
16864         *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
16865         return tag_ptr(ret_conv, true);
16866 }
16867
16868 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_err"))) TS_CResult_COption_TypeZDecodeErrorZ_err(uint64_t e) {
16869         LDKDecodeError e_conv;
16870         e_conv.inner = untag_ptr(e);
16871         e_conv.is_owned = ptr_is_owned(e);
16872         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16873         e_conv = DecodeError_clone(&e_conv);
16874         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
16875         *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
16876         return tag_ptr(ret_conv, true);
16877 }
16878
16879 jboolean  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_is_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_is_ok(uint64_t o) {
16880         LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(o);
16881         jboolean ret_conv = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
16882         return ret_conv;
16883 }
16884
16885 void  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_free"))) TS_CResult_COption_TypeZDecodeErrorZ_free(uint64_t _res) {
16886         if (!ptr_is_owned(_res)) return;
16887         void* _res_ptr = untag_ptr(_res);
16888         CHECK_ACCESS(_res_ptr);
16889         LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
16890         FREE(untag_ptr(_res));
16891         CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
16892 }
16893
16894 static inline uint64_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
16895         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
16896         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
16897         return tag_ptr(ret_conv, true);
16898 }
16899 int64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr(uint64_t arg) {
16900         LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(arg);
16901         int64_t ret_conv = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
16902         return ret_conv;
16903 }
16904
16905 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone"))) TS_CResult_COption_TypeZDecodeErrorZ_clone(uint64_t orig) {
16906         LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(orig);
16907         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
16908         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
16909         return tag_ptr(ret_conv, true);
16910 }
16911
16912 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_ok"))) TS_CResult_PaymentIdPaymentErrorZ_ok(int8_tArray o) {
16913         LDKThirtyTwoBytes o_ref;
16914         CHECK(o->arr_len == 32);
16915         memcpy(o_ref.data, o->elems, 32); FREE(o);
16916         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
16917         *ret_conv = CResult_PaymentIdPaymentErrorZ_ok(o_ref);
16918         return tag_ptr(ret_conv, true);
16919 }
16920
16921 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_err"))) TS_CResult_PaymentIdPaymentErrorZ_err(uint64_t e) {
16922         void* e_ptr = untag_ptr(e);
16923         CHECK_ACCESS(e_ptr);
16924         LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
16925         e_conv = PaymentError_clone((LDKPaymentError*)untag_ptr(e));
16926         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
16927         *ret_conv = CResult_PaymentIdPaymentErrorZ_err(e_conv);
16928         return tag_ptr(ret_conv, true);
16929 }
16930
16931 jboolean  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_is_ok"))) TS_CResult_PaymentIdPaymentErrorZ_is_ok(uint64_t o) {
16932         LDKCResult_PaymentIdPaymentErrorZ* o_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(o);
16933         jboolean ret_conv = CResult_PaymentIdPaymentErrorZ_is_ok(o_conv);
16934         return ret_conv;
16935 }
16936
16937 void  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_free"))) TS_CResult_PaymentIdPaymentErrorZ_free(uint64_t _res) {
16938         if (!ptr_is_owned(_res)) return;
16939         void* _res_ptr = untag_ptr(_res);
16940         CHECK_ACCESS(_res_ptr);
16941         LDKCResult_PaymentIdPaymentErrorZ _res_conv = *(LDKCResult_PaymentIdPaymentErrorZ*)(_res_ptr);
16942         FREE(untag_ptr(_res));
16943         CResult_PaymentIdPaymentErrorZ_free(_res_conv);
16944 }
16945
16946 static inline uint64_t CResult_PaymentIdPaymentErrorZ_clone_ptr(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR arg) {
16947         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
16948         *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(arg);
16949         return tag_ptr(ret_conv, true);
16950 }
16951 int64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_clone_ptr"))) TS_CResult_PaymentIdPaymentErrorZ_clone_ptr(uint64_t arg) {
16952         LDKCResult_PaymentIdPaymentErrorZ* arg_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(arg);
16953         int64_t ret_conv = CResult_PaymentIdPaymentErrorZ_clone_ptr(arg_conv);
16954         return ret_conv;
16955 }
16956
16957 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_clone"))) TS_CResult_PaymentIdPaymentErrorZ_clone(uint64_t orig) {
16958         LDKCResult_PaymentIdPaymentErrorZ* orig_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(orig);
16959         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
16960         *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(orig_conv);
16961         return tag_ptr(ret_conv, true);
16962 }
16963
16964 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_ok(uint64_t o) {
16965         LDKInFlightHtlcs o_conv;
16966         o_conv.inner = untag_ptr(o);
16967         o_conv.is_owned = ptr_is_owned(o);
16968         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16969         // WARNING: we need a move here but no clone is available for LDKInFlightHtlcs
16970         
16971         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
16972         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_ok(o_conv);
16973         return tag_ptr(ret_conv, true);
16974 }
16975
16976 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_err"))) TS_CResult_InFlightHtlcsDecodeErrorZ_err(uint64_t e) {
16977         LDKDecodeError e_conv;
16978         e_conv.inner = untag_ptr(e);
16979         e_conv.is_owned = ptr_is_owned(e);
16980         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16981         e_conv = DecodeError_clone(&e_conv);
16982         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
16983         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_err(e_conv);
16984         return tag_ptr(ret_conv, true);
16985 }
16986
16987 jboolean  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_is_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_is_ok(uint64_t o) {
16988         LDKCResult_InFlightHtlcsDecodeErrorZ* o_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(o);
16989         jboolean ret_conv = CResult_InFlightHtlcsDecodeErrorZ_is_ok(o_conv);
16990         return ret_conv;
16991 }
16992
16993 void  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_free"))) TS_CResult_InFlightHtlcsDecodeErrorZ_free(uint64_t _res) {
16994         if (!ptr_is_owned(_res)) return;
16995         void* _res_ptr = untag_ptr(_res);
16996         CHECK_ACCESS(_res_ptr);
16997         LDKCResult_InFlightHtlcsDecodeErrorZ _res_conv = *(LDKCResult_InFlightHtlcsDecodeErrorZ*)(_res_ptr);
16998         FREE(untag_ptr(_res));
16999         CResult_InFlightHtlcsDecodeErrorZ_free(_res_conv);
17000 }
17001
17002 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_ok"))) TS_CResult_SiPrefixParseErrorZ_ok(uint32_t o) {
17003         LDKSiPrefix o_conv = LDKSiPrefix_from_js(o);
17004         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
17005         *ret_conv = CResult_SiPrefixParseErrorZ_ok(o_conv);
17006         return tag_ptr(ret_conv, true);
17007 }
17008
17009 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_err"))) TS_CResult_SiPrefixParseErrorZ_err(uint64_t e) {
17010         void* e_ptr = untag_ptr(e);
17011         CHECK_ACCESS(e_ptr);
17012         LDKParseError e_conv = *(LDKParseError*)(e_ptr);
17013         e_conv = ParseError_clone((LDKParseError*)untag_ptr(e));
17014         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
17015         *ret_conv = CResult_SiPrefixParseErrorZ_err(e_conv);
17016         return tag_ptr(ret_conv, true);
17017 }
17018
17019 jboolean  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_is_ok"))) TS_CResult_SiPrefixParseErrorZ_is_ok(uint64_t o) {
17020         LDKCResult_SiPrefixParseErrorZ* o_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(o);
17021         jboolean ret_conv = CResult_SiPrefixParseErrorZ_is_ok(o_conv);
17022         return ret_conv;
17023 }
17024
17025 void  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_free"))) TS_CResult_SiPrefixParseErrorZ_free(uint64_t _res) {
17026         if (!ptr_is_owned(_res)) return;
17027         void* _res_ptr = untag_ptr(_res);
17028         CHECK_ACCESS(_res_ptr);
17029         LDKCResult_SiPrefixParseErrorZ _res_conv = *(LDKCResult_SiPrefixParseErrorZ*)(_res_ptr);
17030         FREE(untag_ptr(_res));
17031         CResult_SiPrefixParseErrorZ_free(_res_conv);
17032 }
17033
17034 static inline uint64_t CResult_SiPrefixParseErrorZ_clone_ptr(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR arg) {
17035         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
17036         *ret_conv = CResult_SiPrefixParseErrorZ_clone(arg);
17037         return tag_ptr(ret_conv, true);
17038 }
17039 int64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_clone_ptr"))) TS_CResult_SiPrefixParseErrorZ_clone_ptr(uint64_t arg) {
17040         LDKCResult_SiPrefixParseErrorZ* arg_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(arg);
17041         int64_t ret_conv = CResult_SiPrefixParseErrorZ_clone_ptr(arg_conv);
17042         return ret_conv;
17043 }
17044
17045 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_clone"))) TS_CResult_SiPrefixParseErrorZ_clone(uint64_t orig) {
17046         LDKCResult_SiPrefixParseErrorZ* orig_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(orig);
17047         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
17048         *ret_conv = CResult_SiPrefixParseErrorZ_clone(orig_conv);
17049         return tag_ptr(ret_conv, true);
17050 }
17051
17052 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_ok"))) TS_CResult_InvoiceParseOrSemanticErrorZ_ok(uint64_t o) {
17053         LDKInvoice o_conv;
17054         o_conv.inner = untag_ptr(o);
17055         o_conv.is_owned = ptr_is_owned(o);
17056         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17057         o_conv = Invoice_clone(&o_conv);
17058         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
17059         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_ok(o_conv);
17060         return tag_ptr(ret_conv, true);
17061 }
17062
17063 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_err"))) TS_CResult_InvoiceParseOrSemanticErrorZ_err(uint64_t e) {
17064         void* e_ptr = untag_ptr(e);
17065         CHECK_ACCESS(e_ptr);
17066         LDKParseOrSemanticError e_conv = *(LDKParseOrSemanticError*)(e_ptr);
17067         e_conv = ParseOrSemanticError_clone((LDKParseOrSemanticError*)untag_ptr(e));
17068         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
17069         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_err(e_conv);
17070         return tag_ptr(ret_conv, true);
17071 }
17072
17073 jboolean  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_is_ok"))) TS_CResult_InvoiceParseOrSemanticErrorZ_is_ok(uint64_t o) {
17074         LDKCResult_InvoiceParseOrSemanticErrorZ* o_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(o);
17075         jboolean ret_conv = CResult_InvoiceParseOrSemanticErrorZ_is_ok(o_conv);
17076         return ret_conv;
17077 }
17078
17079 void  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_free"))) TS_CResult_InvoiceParseOrSemanticErrorZ_free(uint64_t _res) {
17080         if (!ptr_is_owned(_res)) return;
17081         void* _res_ptr = untag_ptr(_res);
17082         CHECK_ACCESS(_res_ptr);
17083         LDKCResult_InvoiceParseOrSemanticErrorZ _res_conv = *(LDKCResult_InvoiceParseOrSemanticErrorZ*)(_res_ptr);
17084         FREE(untag_ptr(_res));
17085         CResult_InvoiceParseOrSemanticErrorZ_free(_res_conv);
17086 }
17087
17088 static inline uint64_t CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR arg) {
17089         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
17090         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(arg);
17091         return tag_ptr(ret_conv, true);
17092 }
17093 int64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_clone_ptr"))) TS_CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(uint64_t arg) {
17094         LDKCResult_InvoiceParseOrSemanticErrorZ* arg_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(arg);
17095         int64_t ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(arg_conv);
17096         return ret_conv;
17097 }
17098
17099 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_clone"))) TS_CResult_InvoiceParseOrSemanticErrorZ_clone(uint64_t orig) {
17100         LDKCResult_InvoiceParseOrSemanticErrorZ* orig_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(orig);
17101         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
17102         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(orig_conv);
17103         return tag_ptr(ret_conv, true);
17104 }
17105
17106 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_ok"))) TS_CResult_SignedRawInvoiceParseErrorZ_ok(uint64_t o) {
17107         LDKSignedRawInvoice o_conv;
17108         o_conv.inner = untag_ptr(o);
17109         o_conv.is_owned = ptr_is_owned(o);
17110         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17111         o_conv = SignedRawInvoice_clone(&o_conv);
17112         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
17113         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_ok(o_conv);
17114         return tag_ptr(ret_conv, true);
17115 }
17116
17117 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_err"))) TS_CResult_SignedRawInvoiceParseErrorZ_err(uint64_t e) {
17118         void* e_ptr = untag_ptr(e);
17119         CHECK_ACCESS(e_ptr);
17120         LDKParseError e_conv = *(LDKParseError*)(e_ptr);
17121         e_conv = ParseError_clone((LDKParseError*)untag_ptr(e));
17122         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
17123         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_err(e_conv);
17124         return tag_ptr(ret_conv, true);
17125 }
17126
17127 jboolean  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_is_ok"))) TS_CResult_SignedRawInvoiceParseErrorZ_is_ok(uint64_t o) {
17128         LDKCResult_SignedRawInvoiceParseErrorZ* o_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(o);
17129         jboolean ret_conv = CResult_SignedRawInvoiceParseErrorZ_is_ok(o_conv);
17130         return ret_conv;
17131 }
17132
17133 void  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_free"))) TS_CResult_SignedRawInvoiceParseErrorZ_free(uint64_t _res) {
17134         if (!ptr_is_owned(_res)) return;
17135         void* _res_ptr = untag_ptr(_res);
17136         CHECK_ACCESS(_res_ptr);
17137         LDKCResult_SignedRawInvoiceParseErrorZ _res_conv = *(LDKCResult_SignedRawInvoiceParseErrorZ*)(_res_ptr);
17138         FREE(untag_ptr(_res));
17139         CResult_SignedRawInvoiceParseErrorZ_free(_res_conv);
17140 }
17141
17142 static inline uint64_t CResult_SignedRawInvoiceParseErrorZ_clone_ptr(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR arg) {
17143         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
17144         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(arg);
17145         return tag_ptr(ret_conv, true);
17146 }
17147 int64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_clone_ptr"))) TS_CResult_SignedRawInvoiceParseErrorZ_clone_ptr(uint64_t arg) {
17148         LDKCResult_SignedRawInvoiceParseErrorZ* arg_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(arg);
17149         int64_t ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone_ptr(arg_conv);
17150         return ret_conv;
17151 }
17152
17153 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_clone"))) TS_CResult_SignedRawInvoiceParseErrorZ_clone(uint64_t orig) {
17154         LDKCResult_SignedRawInvoiceParseErrorZ* orig_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(orig);
17155         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
17156         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(orig_conv);
17157         return tag_ptr(ret_conv, true);
17158 }
17159
17160 static inline uint64_t C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR arg) {
17161         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
17162         *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(arg);
17163         return tag_ptr(ret_conv, true);
17164 }
17165 int64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(uint64_t arg) {
17166         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(arg);
17167         int64_t ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(arg_conv);
17168         return ret_conv;
17169 }
17170
17171 uint64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(uint64_t orig) {
17172         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(orig);
17173         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
17174         *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv);
17175         return tag_ptr(ret_conv, true);
17176 }
17177
17178 uint64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_new"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(uint64_t a, int8_tArray b, uint64_t c) {
17179         LDKRawInvoice a_conv;
17180         a_conv.inner = untag_ptr(a);
17181         a_conv.is_owned = ptr_is_owned(a);
17182         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
17183         a_conv = RawInvoice_clone(&a_conv);
17184         LDKThirtyTwoBytes b_ref;
17185         CHECK(b->arr_len == 32);
17186         memcpy(b_ref.data, b->elems, 32); FREE(b);
17187         LDKInvoiceSignature c_conv;
17188         c_conv.inner = untag_ptr(c);
17189         c_conv.is_owned = ptr_is_owned(c);
17190         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
17191         c_conv = InvoiceSignature_clone(&c_conv);
17192         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
17193         *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
17194         return tag_ptr(ret_conv, true);
17195 }
17196
17197 void  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_free"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(uint64_t _res) {
17198         if (!ptr_is_owned(_res)) return;
17199         void* _res_ptr = untag_ptr(_res);
17200         CHECK_ACCESS(_res_ptr);
17201         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(_res_ptr);
17202         FREE(untag_ptr(_res));
17203         C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv);
17204 }
17205
17206 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_ok"))) TS_CResult_PayeePubKeyErrorZ_ok(uint64_t o) {
17207         LDKPayeePubKey o_conv;
17208         o_conv.inner = untag_ptr(o);
17209         o_conv.is_owned = ptr_is_owned(o);
17210         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17211         o_conv = PayeePubKey_clone(&o_conv);
17212         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
17213         *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
17214         return tag_ptr(ret_conv, true);
17215 }
17216
17217 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_err"))) TS_CResult_PayeePubKeyErrorZ_err(uint32_t e) {
17218         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
17219         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
17220         *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
17221         return tag_ptr(ret_conv, true);
17222 }
17223
17224 jboolean  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_is_ok"))) TS_CResult_PayeePubKeyErrorZ_is_ok(uint64_t o) {
17225         LDKCResult_PayeePubKeyErrorZ* o_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(o);
17226         jboolean ret_conv = CResult_PayeePubKeyErrorZ_is_ok(o_conv);
17227         return ret_conv;
17228 }
17229
17230 void  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_free"))) TS_CResult_PayeePubKeyErrorZ_free(uint64_t _res) {
17231         if (!ptr_is_owned(_res)) return;
17232         void* _res_ptr = untag_ptr(_res);
17233         CHECK_ACCESS(_res_ptr);
17234         LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(_res_ptr);
17235         FREE(untag_ptr(_res));
17236         CResult_PayeePubKeyErrorZ_free(_res_conv);
17237 }
17238
17239 static inline uint64_t CResult_PayeePubKeyErrorZ_clone_ptr(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR arg) {
17240         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
17241         *ret_conv = CResult_PayeePubKeyErrorZ_clone(arg);
17242         return tag_ptr(ret_conv, true);
17243 }
17244 int64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_clone_ptr"))) TS_CResult_PayeePubKeyErrorZ_clone_ptr(uint64_t arg) {
17245         LDKCResult_PayeePubKeyErrorZ* arg_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(arg);
17246         int64_t ret_conv = CResult_PayeePubKeyErrorZ_clone_ptr(arg_conv);
17247         return ret_conv;
17248 }
17249
17250 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_clone"))) TS_CResult_PayeePubKeyErrorZ_clone(uint64_t orig) {
17251         LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(orig);
17252         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
17253         *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
17254         return tag_ptr(ret_conv, true);
17255 }
17256
17257 void  __attribute__((export_name("TS_CVec_PrivateRouteZ_free"))) TS_CVec_PrivateRouteZ_free(uint64_tArray _res) {
17258         LDKCVec_PrivateRouteZ _res_constr;
17259         _res_constr.datalen = _res->arr_len;
17260         if (_res_constr.datalen > 0)
17261                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
17262         else
17263                 _res_constr.data = NULL;
17264         uint64_t* _res_vals = _res->elems;
17265         for (size_t o = 0; o < _res_constr.datalen; o++) {
17266                 uint64_t _res_conv_14 = _res_vals[o];
17267                 LDKPrivateRoute _res_conv_14_conv;
17268                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
17269                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
17270                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
17271                 _res_constr.data[o] = _res_conv_14_conv;
17272         }
17273         FREE(_res);
17274         CVec_PrivateRouteZ_free(_res_constr);
17275 }
17276
17277 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_ok(uint64_t o) {
17278         LDKPositiveTimestamp o_conv;
17279         o_conv.inner = untag_ptr(o);
17280         o_conv.is_owned = ptr_is_owned(o);
17281         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17282         o_conv = PositiveTimestamp_clone(&o_conv);
17283         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
17284         *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
17285         return tag_ptr(ret_conv, true);
17286 }
17287
17288 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_err"))) TS_CResult_PositiveTimestampCreationErrorZ_err(uint32_t e) {
17289         LDKCreationError e_conv = LDKCreationError_from_js(e);
17290         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
17291         *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
17292         return tag_ptr(ret_conv, true);
17293 }
17294
17295 jboolean  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_is_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_is_ok(uint64_t o) {
17296         LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(o);
17297         jboolean ret_conv = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv);
17298         return ret_conv;
17299 }
17300
17301 void  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_free"))) TS_CResult_PositiveTimestampCreationErrorZ_free(uint64_t _res) {
17302         if (!ptr_is_owned(_res)) return;
17303         void* _res_ptr = untag_ptr(_res);
17304         CHECK_ACCESS(_res_ptr);
17305         LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
17306         FREE(untag_ptr(_res));
17307         CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
17308 }
17309
17310 static inline uint64_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) {
17311         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
17312         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg);
17313         return tag_ptr(ret_conv, true);
17314 }
17315 int64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr"))) TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr(uint64_t arg) {
17316         LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(arg);
17317         int64_t ret_conv = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv);
17318         return ret_conv;
17319 }
17320
17321 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone"))) TS_CResult_PositiveTimestampCreationErrorZ_clone(uint64_t orig) {
17322         LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(orig);
17323         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
17324         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
17325         return tag_ptr(ret_conv, true);
17326 }
17327
17328 uint64_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_ok"))) TS_CResult_NoneSemanticErrorZ_ok() {
17329         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
17330         *ret_conv = CResult_NoneSemanticErrorZ_ok();
17331         return tag_ptr(ret_conv, true);
17332 }
17333
17334 uint64_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_err"))) TS_CResult_NoneSemanticErrorZ_err(uint32_t e) {
17335         LDKSemanticError e_conv = LDKSemanticError_from_js(e);
17336         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
17337         *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv);
17338         return tag_ptr(ret_conv, true);
17339 }
17340
17341 jboolean  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_is_ok"))) TS_CResult_NoneSemanticErrorZ_is_ok(uint64_t o) {
17342         LDKCResult_NoneSemanticErrorZ* o_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(o);
17343         jboolean ret_conv = CResult_NoneSemanticErrorZ_is_ok(o_conv);
17344         return ret_conv;
17345 }
17346
17347 void  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_free"))) TS_CResult_NoneSemanticErrorZ_free(uint64_t _res) {
17348         if (!ptr_is_owned(_res)) return;
17349         void* _res_ptr = untag_ptr(_res);
17350         CHECK_ACCESS(_res_ptr);
17351         LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(_res_ptr);
17352         FREE(untag_ptr(_res));
17353         CResult_NoneSemanticErrorZ_free(_res_conv);
17354 }
17355
17356 static inline uint64_t CResult_NoneSemanticErrorZ_clone_ptr(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR arg) {
17357         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
17358         *ret_conv = CResult_NoneSemanticErrorZ_clone(arg);
17359         return tag_ptr(ret_conv, true);
17360 }
17361 int64_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_clone_ptr"))) TS_CResult_NoneSemanticErrorZ_clone_ptr(uint64_t arg) {
17362         LDKCResult_NoneSemanticErrorZ* arg_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(arg);
17363         int64_t ret_conv = CResult_NoneSemanticErrorZ_clone_ptr(arg_conv);
17364         return ret_conv;
17365 }
17366
17367 uint64_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_clone"))) TS_CResult_NoneSemanticErrorZ_clone(uint64_t orig) {
17368         LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(orig);
17369         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
17370         *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv);
17371         return tag_ptr(ret_conv, true);
17372 }
17373
17374 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_ok"))) TS_CResult_InvoiceSemanticErrorZ_ok(uint64_t o) {
17375         LDKInvoice o_conv;
17376         o_conv.inner = untag_ptr(o);
17377         o_conv.is_owned = ptr_is_owned(o);
17378         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17379         o_conv = Invoice_clone(&o_conv);
17380         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
17381         *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv);
17382         return tag_ptr(ret_conv, true);
17383 }
17384
17385 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_err"))) TS_CResult_InvoiceSemanticErrorZ_err(uint32_t e) {
17386         LDKSemanticError e_conv = LDKSemanticError_from_js(e);
17387         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
17388         *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv);
17389         return tag_ptr(ret_conv, true);
17390 }
17391
17392 jboolean  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_is_ok"))) TS_CResult_InvoiceSemanticErrorZ_is_ok(uint64_t o) {
17393         LDKCResult_InvoiceSemanticErrorZ* o_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(o);
17394         jboolean ret_conv = CResult_InvoiceSemanticErrorZ_is_ok(o_conv);
17395         return ret_conv;
17396 }
17397
17398 void  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_free"))) TS_CResult_InvoiceSemanticErrorZ_free(uint64_t _res) {
17399         if (!ptr_is_owned(_res)) return;
17400         void* _res_ptr = untag_ptr(_res);
17401         CHECK_ACCESS(_res_ptr);
17402         LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(_res_ptr);
17403         FREE(untag_ptr(_res));
17404         CResult_InvoiceSemanticErrorZ_free(_res_conv);
17405 }
17406
17407 static inline uint64_t CResult_InvoiceSemanticErrorZ_clone_ptr(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR arg) {
17408         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
17409         *ret_conv = CResult_InvoiceSemanticErrorZ_clone(arg);
17410         return tag_ptr(ret_conv, true);
17411 }
17412 int64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_clone_ptr"))) TS_CResult_InvoiceSemanticErrorZ_clone_ptr(uint64_t arg) {
17413         LDKCResult_InvoiceSemanticErrorZ* arg_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(arg);
17414         int64_t ret_conv = CResult_InvoiceSemanticErrorZ_clone_ptr(arg_conv);
17415         return ret_conv;
17416 }
17417
17418 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_clone"))) TS_CResult_InvoiceSemanticErrorZ_clone(uint64_t orig) {
17419         LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(orig);
17420         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
17421         *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv);
17422         return tag_ptr(ret_conv, true);
17423 }
17424
17425 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_ok"))) TS_CResult_DescriptionCreationErrorZ_ok(uint64_t o) {
17426         LDKDescription o_conv;
17427         o_conv.inner = untag_ptr(o);
17428         o_conv.is_owned = ptr_is_owned(o);
17429         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17430         o_conv = Description_clone(&o_conv);
17431         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
17432         *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
17433         return tag_ptr(ret_conv, true);
17434 }
17435
17436 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_err"))) TS_CResult_DescriptionCreationErrorZ_err(uint32_t e) {
17437         LDKCreationError e_conv = LDKCreationError_from_js(e);
17438         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
17439         *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
17440         return tag_ptr(ret_conv, true);
17441 }
17442
17443 jboolean  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_is_ok"))) TS_CResult_DescriptionCreationErrorZ_is_ok(uint64_t o) {
17444         LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(o);
17445         jboolean ret_conv = CResult_DescriptionCreationErrorZ_is_ok(o_conv);
17446         return ret_conv;
17447 }
17448
17449 void  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_free"))) TS_CResult_DescriptionCreationErrorZ_free(uint64_t _res) {
17450         if (!ptr_is_owned(_res)) return;
17451         void* _res_ptr = untag_ptr(_res);
17452         CHECK_ACCESS(_res_ptr);
17453         LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
17454         FREE(untag_ptr(_res));
17455         CResult_DescriptionCreationErrorZ_free(_res_conv);
17456 }
17457
17458 static inline uint64_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) {
17459         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
17460         *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg);
17461         return tag_ptr(ret_conv, true);
17462 }
17463 int64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone_ptr"))) TS_CResult_DescriptionCreationErrorZ_clone_ptr(uint64_t arg) {
17464         LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(arg);
17465         int64_t ret_conv = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv);
17466         return ret_conv;
17467 }
17468
17469 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone"))) TS_CResult_DescriptionCreationErrorZ_clone(uint64_t orig) {
17470         LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(orig);
17471         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
17472         *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
17473         return tag_ptr(ret_conv, true);
17474 }
17475
17476 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_ok"))) TS_CResult_PrivateRouteCreationErrorZ_ok(uint64_t o) {
17477         LDKPrivateRoute o_conv;
17478         o_conv.inner = untag_ptr(o);
17479         o_conv.is_owned = ptr_is_owned(o);
17480         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17481         o_conv = PrivateRoute_clone(&o_conv);
17482         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
17483         *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
17484         return tag_ptr(ret_conv, true);
17485 }
17486
17487 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_err"))) TS_CResult_PrivateRouteCreationErrorZ_err(uint32_t e) {
17488         LDKCreationError e_conv = LDKCreationError_from_js(e);
17489         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
17490         *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
17491         return tag_ptr(ret_conv, true);
17492 }
17493
17494 jboolean  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_is_ok"))) TS_CResult_PrivateRouteCreationErrorZ_is_ok(uint64_t o) {
17495         LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(o);
17496         jboolean ret_conv = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv);
17497         return ret_conv;
17498 }
17499
17500 void  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_free"))) TS_CResult_PrivateRouteCreationErrorZ_free(uint64_t _res) {
17501         if (!ptr_is_owned(_res)) return;
17502         void* _res_ptr = untag_ptr(_res);
17503         CHECK_ACCESS(_res_ptr);
17504         LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
17505         FREE(untag_ptr(_res));
17506         CResult_PrivateRouteCreationErrorZ_free(_res_conv);
17507 }
17508
17509 static inline uint64_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) {
17510         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
17511         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg);
17512         return tag_ptr(ret_conv, true);
17513 }
17514 int64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone_ptr"))) TS_CResult_PrivateRouteCreationErrorZ_clone_ptr(uint64_t arg) {
17515         LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(arg);
17516         int64_t ret_conv = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv);
17517         return ret_conv;
17518 }
17519
17520 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone"))) TS_CResult_PrivateRouteCreationErrorZ_clone(uint64_t orig) {
17521         LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(orig);
17522         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
17523         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
17524         return tag_ptr(ret_conv, true);
17525 }
17526
17527 uint64_t  __attribute__((export_name("TS_CResult_StringErrorZ_ok"))) TS_CResult_StringErrorZ_ok(jstring o) {
17528         LDKStr o_conv = str_ref_to_owned_c(o);
17529         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
17530         *ret_conv = CResult_StringErrorZ_ok(o_conv);
17531         return tag_ptr(ret_conv, true);
17532 }
17533
17534 uint64_t  __attribute__((export_name("TS_CResult_StringErrorZ_err"))) TS_CResult_StringErrorZ_err(uint32_t e) {
17535         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
17536         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
17537         *ret_conv = CResult_StringErrorZ_err(e_conv);
17538         return tag_ptr(ret_conv, true);
17539 }
17540
17541 jboolean  __attribute__((export_name("TS_CResult_StringErrorZ_is_ok"))) TS_CResult_StringErrorZ_is_ok(uint64_t o) {
17542         LDKCResult_StringErrorZ* o_conv = (LDKCResult_StringErrorZ*)untag_ptr(o);
17543         jboolean ret_conv = CResult_StringErrorZ_is_ok(o_conv);
17544         return ret_conv;
17545 }
17546
17547 void  __attribute__((export_name("TS_CResult_StringErrorZ_free"))) TS_CResult_StringErrorZ_free(uint64_t _res) {
17548         if (!ptr_is_owned(_res)) return;
17549         void* _res_ptr = untag_ptr(_res);
17550         CHECK_ACCESS(_res_ptr);
17551         LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(_res_ptr);
17552         FREE(untag_ptr(_res));
17553         CResult_StringErrorZ_free(_res_conv);
17554 }
17555
17556 static inline uint64_t CResult_StringErrorZ_clone_ptr(LDKCResult_StringErrorZ *NONNULL_PTR arg) {
17557         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
17558         *ret_conv = CResult_StringErrorZ_clone(arg);
17559         return tag_ptr(ret_conv, true);
17560 }
17561 int64_t  __attribute__((export_name("TS_CResult_StringErrorZ_clone_ptr"))) TS_CResult_StringErrorZ_clone_ptr(uint64_t arg) {
17562         LDKCResult_StringErrorZ* arg_conv = (LDKCResult_StringErrorZ*)untag_ptr(arg);
17563         int64_t ret_conv = CResult_StringErrorZ_clone_ptr(arg_conv);
17564         return ret_conv;
17565 }
17566
17567 uint64_t  __attribute__((export_name("TS_CResult_StringErrorZ_clone"))) TS_CResult_StringErrorZ_clone(uint64_t orig) {
17568         LDKCResult_StringErrorZ* orig_conv = (LDKCResult_StringErrorZ*)untag_ptr(orig);
17569         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
17570         *ret_conv = CResult_StringErrorZ_clone(orig_conv);
17571         return tag_ptr(ret_conv, true);
17572 }
17573
17574 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok(uint64_t o) {
17575         LDKChannelMonitorUpdate o_conv;
17576         o_conv.inner = untag_ptr(o);
17577         o_conv.is_owned = ptr_is_owned(o);
17578         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17579         o_conv = ChannelMonitorUpdate_clone(&o_conv);
17580         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
17581         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
17582         return tag_ptr(ret_conv, true);
17583 }
17584
17585 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err(uint64_t e) {
17586         LDKDecodeError e_conv;
17587         e_conv.inner = untag_ptr(e);
17588         e_conv.is_owned = ptr_is_owned(e);
17589         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17590         e_conv = DecodeError_clone(&e_conv);
17591         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
17592         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
17593         return tag_ptr(ret_conv, true);
17594 }
17595
17596 jboolean  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(uint64_t o) {
17597         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(o);
17598         jboolean ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
17599         return ret_conv;
17600 }
17601
17602 void  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free(uint64_t _res) {
17603         if (!ptr_is_owned(_res)) return;
17604         void* _res_ptr = untag_ptr(_res);
17605         CHECK_ACCESS(_res_ptr);
17606         LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
17607         FREE(untag_ptr(_res));
17608         CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
17609 }
17610
17611 static inline uint64_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
17612         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
17613         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
17614         return tag_ptr(ret_conv, true);
17615 }
17616 int64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
17617         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(arg);
17618         int64_t ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
17619         return ret_conv;
17620 }
17621
17622 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone(uint64_t orig) {
17623         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(orig);
17624         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
17625         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
17626         return tag_ptr(ret_conv, true);
17627 }
17628
17629 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_some"))) TS_COption_MonitorEventZ_some(uint64_t o) {
17630         void* o_ptr = untag_ptr(o);
17631         CHECK_ACCESS(o_ptr);
17632         LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
17633         o_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(o));
17634         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
17635         *ret_copy = COption_MonitorEventZ_some(o_conv);
17636         uint64_t ret_ref = tag_ptr(ret_copy, true);
17637         return ret_ref;
17638 }
17639
17640 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_none"))) TS_COption_MonitorEventZ_none() {
17641         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
17642         *ret_copy = COption_MonitorEventZ_none();
17643         uint64_t ret_ref = tag_ptr(ret_copy, true);
17644         return ret_ref;
17645 }
17646
17647 void  __attribute__((export_name("TS_COption_MonitorEventZ_free"))) TS_COption_MonitorEventZ_free(uint64_t _res) {
17648         if (!ptr_is_owned(_res)) return;
17649         void* _res_ptr = untag_ptr(_res);
17650         CHECK_ACCESS(_res_ptr);
17651         LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
17652         FREE(untag_ptr(_res));
17653         COption_MonitorEventZ_free(_res_conv);
17654 }
17655
17656 static inline uint64_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
17657         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
17658         *ret_copy = COption_MonitorEventZ_clone(arg);
17659         uint64_t ret_ref = tag_ptr(ret_copy, true);
17660         return ret_ref;
17661 }
17662 int64_t  __attribute__((export_name("TS_COption_MonitorEventZ_clone_ptr"))) TS_COption_MonitorEventZ_clone_ptr(uint64_t arg) {
17663         LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)untag_ptr(arg);
17664         int64_t ret_conv = COption_MonitorEventZ_clone_ptr(arg_conv);
17665         return ret_conv;
17666 }
17667
17668 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_clone"))) TS_COption_MonitorEventZ_clone(uint64_t orig) {
17669         LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)untag_ptr(orig);
17670         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
17671         *ret_copy = COption_MonitorEventZ_clone(orig_conv);
17672         uint64_t ret_ref = tag_ptr(ret_copy, true);
17673         return ret_ref;
17674 }
17675
17676 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_ok(uint64_t o) {
17677         void* o_ptr = untag_ptr(o);
17678         CHECK_ACCESS(o_ptr);
17679         LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
17680         o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)untag_ptr(o));
17681         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
17682         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
17683         return tag_ptr(ret_conv, true);
17684 }
17685
17686 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_err(uint64_t e) {
17687         LDKDecodeError e_conv;
17688         e_conv.inner = untag_ptr(e);
17689         e_conv.is_owned = ptr_is_owned(e);
17690         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17691         e_conv = DecodeError_clone(&e_conv);
17692         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
17693         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
17694         return tag_ptr(ret_conv, true);
17695 }
17696
17697 jboolean  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok(uint64_t o) {
17698         LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(o);
17699         jboolean ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
17700         return ret_conv;
17701 }
17702
17703 void  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_free"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_free(uint64_t _res) {
17704         if (!ptr_is_owned(_res)) return;
17705         void* _res_ptr = untag_ptr(_res);
17706         CHECK_ACCESS(_res_ptr);
17707         LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
17708         FREE(untag_ptr(_res));
17709         CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
17710 }
17711
17712 static inline uint64_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
17713         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
17714         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
17715         return tag_ptr(ret_conv, true);
17716 }
17717 int64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(uint64_t arg) {
17718         LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(arg);
17719         int64_t ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
17720         return ret_conv;
17721 }
17722
17723 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone(uint64_t orig) {
17724         LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(orig);
17725         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
17726         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
17727         return tag_ptr(ret_conv, true);
17728 }
17729
17730 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_ok(uint64_t o) {
17731         LDKHTLCUpdate o_conv;
17732         o_conv.inner = untag_ptr(o);
17733         o_conv.is_owned = ptr_is_owned(o);
17734         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17735         o_conv = HTLCUpdate_clone(&o_conv);
17736         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
17737         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
17738         return tag_ptr(ret_conv, true);
17739 }
17740
17741 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_err(uint64_t e) {
17742         LDKDecodeError e_conv;
17743         e_conv.inner = untag_ptr(e);
17744         e_conv.is_owned = ptr_is_owned(e);
17745         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17746         e_conv = DecodeError_clone(&e_conv);
17747         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
17748         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
17749         return tag_ptr(ret_conv, true);
17750 }
17751
17752 jboolean  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_is_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_is_ok(uint64_t o) {
17753         LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(o);
17754         jboolean ret_conv = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
17755         return ret_conv;
17756 }
17757
17758 void  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_free"))) TS_CResult_HTLCUpdateDecodeErrorZ_free(uint64_t _res) {
17759         if (!ptr_is_owned(_res)) return;
17760         void* _res_ptr = untag_ptr(_res);
17761         CHECK_ACCESS(_res_ptr);
17762         LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
17763         FREE(untag_ptr(_res));
17764         CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
17765 }
17766
17767 static inline uint64_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
17768         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
17769         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
17770         return tag_ptr(ret_conv, true);
17771 }
17772 int64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
17773         LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(arg);
17774         int64_t ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
17775         return ret_conv;
17776 }
17777
17778 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone(uint64_t orig) {
17779         LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(orig);
17780         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
17781         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
17782         return tag_ptr(ret_conv, true);
17783 }
17784
17785 static inline uint64_t C2Tuple_OutPointScriptZ_clone_ptr(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR arg) {
17786         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
17787         *ret_conv = C2Tuple_OutPointScriptZ_clone(arg);
17788         return tag_ptr(ret_conv, true);
17789 }
17790 int64_t  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_clone_ptr"))) TS_C2Tuple_OutPointScriptZ_clone_ptr(uint64_t arg) {
17791         LDKC2Tuple_OutPointScriptZ* arg_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(arg);
17792         int64_t ret_conv = C2Tuple_OutPointScriptZ_clone_ptr(arg_conv);
17793         return ret_conv;
17794 }
17795
17796 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_clone"))) TS_C2Tuple_OutPointScriptZ_clone(uint64_t orig) {
17797         LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(orig);
17798         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
17799         *ret_conv = C2Tuple_OutPointScriptZ_clone(orig_conv);
17800         return tag_ptr(ret_conv, true);
17801 }
17802
17803 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_new"))) TS_C2Tuple_OutPointScriptZ_new(uint64_t a, int8_tArray b) {
17804         LDKOutPoint a_conv;
17805         a_conv.inner = untag_ptr(a);
17806         a_conv.is_owned = ptr_is_owned(a);
17807         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
17808         a_conv = OutPoint_clone(&a_conv);
17809         LDKCVec_u8Z b_ref;
17810         b_ref.datalen = b->arr_len;
17811         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
17812         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
17813         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
17814         *ret_conv = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
17815         return tag_ptr(ret_conv, true);
17816 }
17817
17818 void  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_free"))) TS_C2Tuple_OutPointScriptZ_free(uint64_t _res) {
17819         if (!ptr_is_owned(_res)) return;
17820         void* _res_ptr = untag_ptr(_res);
17821         CHECK_ACCESS(_res_ptr);
17822         LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(_res_ptr);
17823         FREE(untag_ptr(_res));
17824         C2Tuple_OutPointScriptZ_free(_res_conv);
17825 }
17826
17827 static inline uint64_t C2Tuple_u32ScriptZ_clone_ptr(LDKC2Tuple_u32ScriptZ *NONNULL_PTR arg) {
17828         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
17829         *ret_conv = C2Tuple_u32ScriptZ_clone(arg);
17830         return tag_ptr(ret_conv, true);
17831 }
17832 int64_t  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_clone_ptr"))) TS_C2Tuple_u32ScriptZ_clone_ptr(uint64_t arg) {
17833         LDKC2Tuple_u32ScriptZ* arg_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(arg);
17834         int64_t ret_conv = C2Tuple_u32ScriptZ_clone_ptr(arg_conv);
17835         return ret_conv;
17836 }
17837
17838 uint64_t  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_clone"))) TS_C2Tuple_u32ScriptZ_clone(uint64_t orig) {
17839         LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(orig);
17840         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
17841         *ret_conv = C2Tuple_u32ScriptZ_clone(orig_conv);
17842         return tag_ptr(ret_conv, true);
17843 }
17844
17845 uint64_t  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_new"))) TS_C2Tuple_u32ScriptZ_new(int32_t a, int8_tArray b) {
17846         LDKCVec_u8Z b_ref;
17847         b_ref.datalen = b->arr_len;
17848         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
17849         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
17850         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
17851         *ret_conv = C2Tuple_u32ScriptZ_new(a, b_ref);
17852         return tag_ptr(ret_conv, true);
17853 }
17854
17855 void  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_free"))) TS_C2Tuple_u32ScriptZ_free(uint64_t _res) {
17856         if (!ptr_is_owned(_res)) return;
17857         void* _res_ptr = untag_ptr(_res);
17858         CHECK_ACCESS(_res_ptr);
17859         LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_ptr);
17860         FREE(untag_ptr(_res));
17861         C2Tuple_u32ScriptZ_free(_res_conv);
17862 }
17863
17864 void  __attribute__((export_name("TS_CVec_C2Tuple_u32ScriptZZ_free"))) TS_CVec_C2Tuple_u32ScriptZZ_free(uint64_tArray _res) {
17865         LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
17866         _res_constr.datalen = _res->arr_len;
17867         if (_res_constr.datalen > 0)
17868                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
17869         else
17870                 _res_constr.data = NULL;
17871         uint64_t* _res_vals = _res->elems;
17872         for (size_t v = 0; v < _res_constr.datalen; v++) {
17873                 uint64_t _res_conv_21 = _res_vals[v];
17874                 void* _res_conv_21_ptr = untag_ptr(_res_conv_21);
17875                 CHECK_ACCESS(_res_conv_21_ptr);
17876                 LDKC2Tuple_u32ScriptZ _res_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_conv_21_ptr);
17877                 FREE(untag_ptr(_res_conv_21));
17878                 _res_constr.data[v] = _res_conv_21_conv;
17879         }
17880         FREE(_res);
17881         CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
17882 }
17883
17884 static inline uint64_t C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR arg) {
17885         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
17886         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(arg);
17887         return tag_ptr(ret_conv, true);
17888 }
17889 int64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(uint64_t arg) {
17890         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(arg);
17891         int64_t ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(arg_conv);
17892         return ret_conv;
17893 }
17894
17895 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(uint64_t orig) {
17896         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(orig);
17897         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
17898         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
17899         return tag_ptr(ret_conv, true);
17900 }
17901
17902 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(int8_tArray a, uint64_tArray b) {
17903         LDKThirtyTwoBytes a_ref;
17904         CHECK(a->arr_len == 32);
17905         memcpy(a_ref.data, a->elems, 32); FREE(a);
17906         LDKCVec_C2Tuple_u32ScriptZZ b_constr;
17907         b_constr.datalen = b->arr_len;
17908         if (b_constr.datalen > 0)
17909                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
17910         else
17911                 b_constr.data = NULL;
17912         uint64_t* b_vals = b->elems;
17913         for (size_t v = 0; v < b_constr.datalen; v++) {
17914                 uint64_t b_conv_21 = b_vals[v];
17915                 void* b_conv_21_ptr = untag_ptr(b_conv_21);
17916                 CHECK_ACCESS(b_conv_21_ptr);
17917                 LDKC2Tuple_u32ScriptZ b_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(b_conv_21_ptr);
17918                 b_conv_21_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)untag_ptr(b_conv_21));
17919                 b_constr.data[v] = b_conv_21_conv;
17920         }
17921         FREE(b);
17922         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
17923         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
17924         return tag_ptr(ret_conv, true);
17925 }
17926
17927 void  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(uint64_t _res) {
17928         if (!ptr_is_owned(_res)) return;
17929         void* _res_ptr = untag_ptr(_res);
17930         CHECK_ACCESS(_res_ptr);
17931         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_ptr);
17932         FREE(untag_ptr(_res));
17933         C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
17934 }
17935
17936 void  __attribute__((export_name("TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(uint64_tArray _res) {
17937         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
17938         _res_constr.datalen = _res->arr_len;
17939         if (_res_constr.datalen > 0)
17940                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
17941         else
17942                 _res_constr.data = NULL;
17943         uint64_t* _res_vals = _res->elems;
17944         for (size_t o = 0; o < _res_constr.datalen; o++) {
17945                 uint64_t _res_conv_40 = _res_vals[o];
17946                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
17947                 CHECK_ACCESS(_res_conv_40_ptr);
17948                 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_40_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_conv_40_ptr);
17949                 FREE(untag_ptr(_res_conv_40));
17950                 _res_constr.data[o] = _res_conv_40_conv;
17951         }
17952         FREE(_res);
17953         CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
17954 }
17955
17956 void  __attribute__((export_name("TS_CVec_EventZ_free"))) TS_CVec_EventZ_free(uint64_tArray _res) {
17957         LDKCVec_EventZ _res_constr;
17958         _res_constr.datalen = _res->arr_len;
17959         if (_res_constr.datalen > 0)
17960                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
17961         else
17962                 _res_constr.data = NULL;
17963         uint64_t* _res_vals = _res->elems;
17964         for (size_t h = 0; h < _res_constr.datalen; h++) {
17965                 uint64_t _res_conv_7 = _res_vals[h];
17966                 void* _res_conv_7_ptr = untag_ptr(_res_conv_7);
17967                 CHECK_ACCESS(_res_conv_7_ptr);
17968                 LDKEvent _res_conv_7_conv = *(LDKEvent*)(_res_conv_7_ptr);
17969                 FREE(untag_ptr(_res_conv_7));
17970                 _res_constr.data[h] = _res_conv_7_conv;
17971         }
17972         FREE(_res);
17973         CVec_EventZ_free(_res_constr);
17974 }
17975
17976 void  __attribute__((export_name("TS_CVec_TransactionZ_free"))) TS_CVec_TransactionZ_free(ptrArray _res) {
17977         LDKCVec_TransactionZ _res_constr;
17978         _res_constr.datalen = _res->arr_len;
17979         if (_res_constr.datalen > 0)
17980                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
17981         else
17982                 _res_constr.data = NULL;
17983         int8_tArray* _res_vals = (void*) _res->elems;
17984         for (size_t m = 0; m < _res_constr.datalen; m++) {
17985                 int8_tArray _res_conv_12 = _res_vals[m];
17986                 LDKTransaction _res_conv_12_ref;
17987                 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
17988                 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKTransaction Bytes");
17989                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
17990                 _res_conv_12_ref.data_is_owned = true;
17991                 _res_constr.data[m] = _res_conv_12_ref;
17992         }
17993         FREE(_res);
17994         CVec_TransactionZ_free(_res_constr);
17995 }
17996
17997 static inline uint64_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
17998         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
17999         *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
18000         return tag_ptr(ret_conv, true);
18001 }
18002 int64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone_ptr"))) TS_C2Tuple_u32TxOutZ_clone_ptr(uint64_t arg) {
18003         LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(arg);
18004         int64_t ret_conv = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
18005         return ret_conv;
18006 }
18007
18008 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone"))) TS_C2Tuple_u32TxOutZ_clone(uint64_t orig) {
18009         LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(orig);
18010         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
18011         *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
18012         return tag_ptr(ret_conv, true);
18013 }
18014
18015 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_new"))) TS_C2Tuple_u32TxOutZ_new(int32_t a, uint64_t b) {
18016         void* b_ptr = untag_ptr(b);
18017         CHECK_ACCESS(b_ptr);
18018         LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
18019         b_conv = TxOut_clone((LDKTxOut*)untag_ptr(b));
18020         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
18021         *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
18022         return tag_ptr(ret_conv, true);
18023 }
18024
18025 void  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_free"))) TS_C2Tuple_u32TxOutZ_free(uint64_t _res) {
18026         if (!ptr_is_owned(_res)) return;
18027         void* _res_ptr = untag_ptr(_res);
18028         CHECK_ACCESS(_res_ptr);
18029         LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
18030         FREE(untag_ptr(_res));
18031         C2Tuple_u32TxOutZ_free(_res_conv);
18032 }
18033
18034 void  __attribute__((export_name("TS_CVec_C2Tuple_u32TxOutZZ_free"))) TS_CVec_C2Tuple_u32TxOutZZ_free(uint64_tArray _res) {
18035         LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
18036         _res_constr.datalen = _res->arr_len;
18037         if (_res_constr.datalen > 0)
18038                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
18039         else
18040                 _res_constr.data = NULL;
18041         uint64_t* _res_vals = _res->elems;
18042         for (size_t u = 0; u < _res_constr.datalen; u++) {
18043                 uint64_t _res_conv_20 = _res_vals[u];
18044                 void* _res_conv_20_ptr = untag_ptr(_res_conv_20);
18045                 CHECK_ACCESS(_res_conv_20_ptr);
18046                 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
18047                 FREE(untag_ptr(_res_conv_20));
18048                 _res_constr.data[u] = _res_conv_20_conv;
18049         }
18050         FREE(_res);
18051         CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
18052 }
18053
18054 static inline uint64_t C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
18055         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
18056         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(arg);
18057         return tag_ptr(ret_conv, true);
18058 }
18059 int64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(uint64_t arg) {
18060         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(arg);
18061         int64_t ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
18062         return ret_conv;
18063 }
18064
18065 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(uint64_t orig) {
18066         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(orig);
18067         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
18068         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
18069         return tag_ptr(ret_conv, true);
18070 }
18071
18072 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint64_tArray b) {
18073         LDKThirtyTwoBytes a_ref;
18074         CHECK(a->arr_len == 32);
18075         memcpy(a_ref.data, a->elems, 32); FREE(a);
18076         LDKCVec_C2Tuple_u32TxOutZZ b_constr;
18077         b_constr.datalen = b->arr_len;
18078         if (b_constr.datalen > 0)
18079                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
18080         else
18081                 b_constr.data = NULL;
18082         uint64_t* b_vals = b->elems;
18083         for (size_t u = 0; u < b_constr.datalen; u++) {
18084                 uint64_t b_conv_20 = b_vals[u];
18085                 void* b_conv_20_ptr = untag_ptr(b_conv_20);
18086                 CHECK_ACCESS(b_conv_20_ptr);
18087                 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
18088                 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)untag_ptr(b_conv_20));
18089                 b_constr.data[u] = b_conv_20_conv;
18090         }
18091         FREE(b);
18092         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
18093         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
18094         return tag_ptr(ret_conv, true);
18095 }
18096
18097 void  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(uint64_t _res) {
18098         if (!ptr_is_owned(_res)) return;
18099         void* _res_ptr = untag_ptr(_res);
18100         CHECK_ACCESS(_res_ptr);
18101         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
18102         FREE(untag_ptr(_res));
18103         C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
18104 }
18105
18106 void  __attribute__((export_name("TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(uint64_tArray _res) {
18107         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
18108         _res_constr.datalen = _res->arr_len;
18109         if (_res_constr.datalen > 0)
18110                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
18111         else
18112                 _res_constr.data = NULL;
18113         uint64_t* _res_vals = _res->elems;
18114         for (size_t n = 0; n < _res_constr.datalen; n++) {
18115                 uint64_t _res_conv_39 = _res_vals[n];
18116                 void* _res_conv_39_ptr = untag_ptr(_res_conv_39);
18117                 CHECK_ACCESS(_res_conv_39_ptr);
18118                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_39_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_39_ptr);
18119                 FREE(untag_ptr(_res_conv_39));
18120                 _res_constr.data[n] = _res_conv_39_conv;
18121         }
18122         FREE(_res);
18123         CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
18124 }
18125
18126 void  __attribute__((export_name("TS_CVec_BalanceZ_free"))) TS_CVec_BalanceZ_free(uint64_tArray _res) {
18127         LDKCVec_BalanceZ _res_constr;
18128         _res_constr.datalen = _res->arr_len;
18129         if (_res_constr.datalen > 0)
18130                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
18131         else
18132                 _res_constr.data = NULL;
18133         uint64_t* _res_vals = _res->elems;
18134         for (size_t j = 0; j < _res_constr.datalen; j++) {
18135                 uint64_t _res_conv_9 = _res_vals[j];
18136                 void* _res_conv_9_ptr = untag_ptr(_res_conv_9);
18137                 CHECK_ACCESS(_res_conv_9_ptr);
18138                 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
18139                 FREE(untag_ptr(_res_conv_9));
18140                 _res_constr.data[j] = _res_conv_9_conv;
18141         }
18142         FREE(_res);
18143         CVec_BalanceZ_free(_res_constr);
18144 }
18145
18146 static inline uint64_t C2Tuple_BlockHashChannelMonitorZ_clone_ptr(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR arg) {
18147         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
18148         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(arg);
18149         return tag_ptr(ret_conv, true);
18150 }
18151 int64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_clone_ptr"))) TS_C2Tuple_BlockHashChannelMonitorZ_clone_ptr(uint64_t arg) {
18152         LDKC2Tuple_BlockHashChannelMonitorZ* arg_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(arg);
18153         int64_t ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone_ptr(arg_conv);
18154         return ret_conv;
18155 }
18156
18157 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_clone"))) TS_C2Tuple_BlockHashChannelMonitorZ_clone(uint64_t orig) {
18158         LDKC2Tuple_BlockHashChannelMonitorZ* orig_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(orig);
18159         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
18160         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(orig_conv);
18161         return tag_ptr(ret_conv, true);
18162 }
18163
18164 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_new"))) TS_C2Tuple_BlockHashChannelMonitorZ_new(int8_tArray a, uint64_t b) {
18165         LDKThirtyTwoBytes a_ref;
18166         CHECK(a->arr_len == 32);
18167         memcpy(a_ref.data, a->elems, 32); FREE(a);
18168         LDKChannelMonitor b_conv;
18169         b_conv.inner = untag_ptr(b);
18170         b_conv.is_owned = ptr_is_owned(b);
18171         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
18172         b_conv = ChannelMonitor_clone(&b_conv);
18173         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
18174         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
18175         return tag_ptr(ret_conv, true);
18176 }
18177
18178 void  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_free"))) TS_C2Tuple_BlockHashChannelMonitorZ_free(uint64_t _res) {
18179         if (!ptr_is_owned(_res)) return;
18180         void* _res_ptr = untag_ptr(_res);
18181         CHECK_ACCESS(_res_ptr);
18182         LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_ptr);
18183         FREE(untag_ptr(_res));
18184         C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
18185 }
18186
18187 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(uint64_t o) {
18188         void* o_ptr = untag_ptr(o);
18189         CHECK_ACCESS(o_ptr);
18190         LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_ptr);
18191         o_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(o));
18192         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
18193         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
18194         return tag_ptr(ret_conv, true);
18195 }
18196
18197 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(uint64_t e) {
18198         LDKDecodeError e_conv;
18199         e_conv.inner = untag_ptr(e);
18200         e_conv.is_owned = ptr_is_owned(e);
18201         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18202         e_conv = DecodeError_clone(&e_conv);
18203         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
18204         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
18205         return tag_ptr(ret_conv, true);
18206 }
18207
18208 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(uint64_t o) {
18209         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(o);
18210         jboolean ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o_conv);
18211         return ret_conv;
18212 }
18213
18214 void  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(uint64_t _res) {
18215         if (!ptr_is_owned(_res)) return;
18216         void* _res_ptr = untag_ptr(_res);
18217         CHECK_ACCESS(_res_ptr);
18218         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(_res_ptr);
18219         FREE(untag_ptr(_res));
18220         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
18221 }
18222
18223 static inline uint64_t CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
18224         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
18225         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(arg);
18226         return tag_ptr(ret_conv, true);
18227 }
18228 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(uint64_t arg) {
18229         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(arg);
18230         int64_t ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
18231         return ret_conv;
18232 }
18233
18234 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(uint64_t orig) {
18235         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(orig);
18236         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
18237         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(orig_conv);
18238         return tag_ptr(ret_conv, true);
18239 }
18240
18241 static inline uint64_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
18242         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
18243         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
18244         return tag_ptr(ret_conv, true);
18245 }
18246 int64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone_ptr"))) TS_C2Tuple_PublicKeyTypeZ_clone_ptr(uint64_t arg) {
18247         LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(arg);
18248         int64_t ret_conv = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
18249         return ret_conv;
18250 }
18251
18252 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone"))) TS_C2Tuple_PublicKeyTypeZ_clone(uint64_t orig) {
18253         LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(orig);
18254         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
18255         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
18256         return tag_ptr(ret_conv, true);
18257 }
18258
18259 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_new"))) TS_C2Tuple_PublicKeyTypeZ_new(int8_tArray a, uint64_t b) {
18260         LDKPublicKey a_ref;
18261         CHECK(a->arr_len == 33);
18262         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
18263         void* b_ptr = untag_ptr(b);
18264         CHECK_ACCESS(b_ptr);
18265         LDKType b_conv = *(LDKType*)(b_ptr);
18266         if (b_conv.free == LDKType_JCalls_free) {
18267                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18268                 LDKType_JCalls_cloned(&b_conv);
18269         }
18270         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
18271         *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
18272         return tag_ptr(ret_conv, true);
18273 }
18274
18275 void  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_free"))) TS_C2Tuple_PublicKeyTypeZ_free(uint64_t _res) {
18276         if (!ptr_is_owned(_res)) return;
18277         void* _res_ptr = untag_ptr(_res);
18278         CHECK_ACCESS(_res_ptr);
18279         LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
18280         FREE(untag_ptr(_res));
18281         C2Tuple_PublicKeyTypeZ_free(_res_conv);
18282 }
18283
18284 void  __attribute__((export_name("TS_CVec_C2Tuple_PublicKeyTypeZZ_free"))) TS_CVec_C2Tuple_PublicKeyTypeZZ_free(uint64_tArray _res) {
18285         LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
18286         _res_constr.datalen = _res->arr_len;
18287         if (_res_constr.datalen > 0)
18288                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
18289         else
18290                 _res_constr.data = NULL;
18291         uint64_t* _res_vals = _res->elems;
18292         for (size_t z = 0; z < _res_constr.datalen; z++) {
18293                 uint64_t _res_conv_25 = _res_vals[z];
18294                 void* _res_conv_25_ptr = untag_ptr(_res_conv_25);
18295                 CHECK_ACCESS(_res_conv_25_ptr);
18296                 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
18297                 FREE(untag_ptr(_res_conv_25));
18298                 _res_constr.data[z] = _res_conv_25_conv;
18299         }
18300         FREE(_res);
18301         CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
18302 }
18303
18304 uint64_t  __attribute__((export_name("TS_COption_NetAddressZ_some"))) TS_COption_NetAddressZ_some(uint64_t o) {
18305         void* o_ptr = untag_ptr(o);
18306         CHECK_ACCESS(o_ptr);
18307         LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
18308         o_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o));
18309         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
18310         *ret_copy = COption_NetAddressZ_some(o_conv);
18311         uint64_t ret_ref = tag_ptr(ret_copy, true);
18312         return ret_ref;
18313 }
18314
18315 uint64_t  __attribute__((export_name("TS_COption_NetAddressZ_none"))) TS_COption_NetAddressZ_none() {
18316         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
18317         *ret_copy = COption_NetAddressZ_none();
18318         uint64_t ret_ref = tag_ptr(ret_copy, true);
18319         return ret_ref;
18320 }
18321
18322 void  __attribute__((export_name("TS_COption_NetAddressZ_free"))) TS_COption_NetAddressZ_free(uint64_t _res) {
18323         if (!ptr_is_owned(_res)) return;
18324         void* _res_ptr = untag_ptr(_res);
18325         CHECK_ACCESS(_res_ptr);
18326         LDKCOption_NetAddressZ _res_conv = *(LDKCOption_NetAddressZ*)(_res_ptr);
18327         FREE(untag_ptr(_res));
18328         COption_NetAddressZ_free(_res_conv);
18329 }
18330
18331 static inline uint64_t COption_NetAddressZ_clone_ptr(LDKCOption_NetAddressZ *NONNULL_PTR arg) {
18332         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
18333         *ret_copy = COption_NetAddressZ_clone(arg);
18334         uint64_t ret_ref = tag_ptr(ret_copy, true);
18335         return ret_ref;
18336 }
18337 int64_t  __attribute__((export_name("TS_COption_NetAddressZ_clone_ptr"))) TS_COption_NetAddressZ_clone_ptr(uint64_t arg) {
18338         LDKCOption_NetAddressZ* arg_conv = (LDKCOption_NetAddressZ*)untag_ptr(arg);
18339         int64_t ret_conv = COption_NetAddressZ_clone_ptr(arg_conv);
18340         return ret_conv;
18341 }
18342
18343 uint64_t  __attribute__((export_name("TS_COption_NetAddressZ_clone"))) TS_COption_NetAddressZ_clone(uint64_t orig) {
18344         LDKCOption_NetAddressZ* orig_conv = (LDKCOption_NetAddressZ*)untag_ptr(orig);
18345         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
18346         *ret_copy = COption_NetAddressZ_clone(orig_conv);
18347         uint64_t ret_ref = tag_ptr(ret_copy, true);
18348         return ret_ref;
18349 }
18350
18351 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_ok(int8_tArray o) {
18352         LDKCVec_u8Z o_ref;
18353         o_ref.datalen = o->arr_len;
18354         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
18355         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
18356         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
18357         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
18358         return tag_ptr(ret_conv, true);
18359 }
18360
18361 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_err(uint64_t e) {
18362         LDKPeerHandleError e_conv;
18363         e_conv.inner = untag_ptr(e);
18364         e_conv.is_owned = ptr_is_owned(e);
18365         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18366         e_conv = PeerHandleError_clone(&e_conv);
18367         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
18368         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
18369         return tag_ptr(ret_conv, true);
18370 }
18371
18372 jboolean  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok(uint64_t o) {
18373         LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(o);
18374         jboolean ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
18375         return ret_conv;
18376 }
18377
18378 void  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_free"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_free(uint64_t _res) {
18379         if (!ptr_is_owned(_res)) return;
18380         void* _res_ptr = untag_ptr(_res);
18381         CHECK_ACCESS(_res_ptr);
18382         LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
18383         FREE(untag_ptr(_res));
18384         CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
18385 }
18386
18387 static inline uint64_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
18388         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
18389         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
18390         return tag_ptr(ret_conv, true);
18391 }
18392 int64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(uint64_t arg) {
18393         LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(arg);
18394         int64_t ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
18395         return ret_conv;
18396 }
18397
18398 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone(uint64_t orig) {
18399         LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(orig);
18400         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
18401         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
18402         return tag_ptr(ret_conv, true);
18403 }
18404
18405 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_ok"))) TS_CResult_NonePeerHandleErrorZ_ok() {
18406         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
18407         *ret_conv = CResult_NonePeerHandleErrorZ_ok();
18408         return tag_ptr(ret_conv, true);
18409 }
18410
18411 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_err"))) TS_CResult_NonePeerHandleErrorZ_err(uint64_t e) {
18412         LDKPeerHandleError e_conv;
18413         e_conv.inner = untag_ptr(e);
18414         e_conv.is_owned = ptr_is_owned(e);
18415         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18416         e_conv = PeerHandleError_clone(&e_conv);
18417         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
18418         *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
18419         return tag_ptr(ret_conv, true);
18420 }
18421
18422 jboolean  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_is_ok"))) TS_CResult_NonePeerHandleErrorZ_is_ok(uint64_t o) {
18423         LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(o);
18424         jboolean ret_conv = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
18425         return ret_conv;
18426 }
18427
18428 void  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_free"))) TS_CResult_NonePeerHandleErrorZ_free(uint64_t _res) {
18429         if (!ptr_is_owned(_res)) return;
18430         void* _res_ptr = untag_ptr(_res);
18431         CHECK_ACCESS(_res_ptr);
18432         LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
18433         FREE(untag_ptr(_res));
18434         CResult_NonePeerHandleErrorZ_free(_res_conv);
18435 }
18436
18437 static inline uint64_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
18438         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
18439         *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
18440         return tag_ptr(ret_conv, true);
18441 }
18442 int64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone_ptr"))) TS_CResult_NonePeerHandleErrorZ_clone_ptr(uint64_t arg) {
18443         LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(arg);
18444         int64_t ret_conv = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
18445         return ret_conv;
18446 }
18447
18448 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone"))) TS_CResult_NonePeerHandleErrorZ_clone(uint64_t orig) {
18449         LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(orig);
18450         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
18451         *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
18452         return tag_ptr(ret_conv, true);
18453 }
18454
18455 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_ok"))) TS_CResult_boolPeerHandleErrorZ_ok(jboolean o) {
18456         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
18457         *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
18458         return tag_ptr(ret_conv, true);
18459 }
18460
18461 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_err"))) TS_CResult_boolPeerHandleErrorZ_err(uint64_t e) {
18462         LDKPeerHandleError e_conv;
18463         e_conv.inner = untag_ptr(e);
18464         e_conv.is_owned = ptr_is_owned(e);
18465         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18466         e_conv = PeerHandleError_clone(&e_conv);
18467         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
18468         *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
18469         return tag_ptr(ret_conv, true);
18470 }
18471
18472 jboolean  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_is_ok"))) TS_CResult_boolPeerHandleErrorZ_is_ok(uint64_t o) {
18473         LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(o);
18474         jboolean ret_conv = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
18475         return ret_conv;
18476 }
18477
18478 void  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_free"))) TS_CResult_boolPeerHandleErrorZ_free(uint64_t _res) {
18479         if (!ptr_is_owned(_res)) return;
18480         void* _res_ptr = untag_ptr(_res);
18481         CHECK_ACCESS(_res_ptr);
18482         LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
18483         FREE(untag_ptr(_res));
18484         CResult_boolPeerHandleErrorZ_free(_res_conv);
18485 }
18486
18487 static inline uint64_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
18488         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
18489         *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
18490         return tag_ptr(ret_conv, true);
18491 }
18492 int64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone_ptr"))) TS_CResult_boolPeerHandleErrorZ_clone_ptr(uint64_t arg) {
18493         LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(arg);
18494         int64_t ret_conv = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
18495         return ret_conv;
18496 }
18497
18498 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone"))) TS_CResult_boolPeerHandleErrorZ_clone(uint64_t orig) {
18499         LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(orig);
18500         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
18501         *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
18502         return tag_ptr(ret_conv, true);
18503 }
18504
18505 uint64_t  __attribute__((export_name("TS_CResult_NoneSendErrorZ_ok"))) TS_CResult_NoneSendErrorZ_ok() {
18506         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
18507         *ret_conv = CResult_NoneSendErrorZ_ok();
18508         return tag_ptr(ret_conv, true);
18509 }
18510
18511 uint64_t  __attribute__((export_name("TS_CResult_NoneSendErrorZ_err"))) TS_CResult_NoneSendErrorZ_err(uint64_t e) {
18512         void* e_ptr = untag_ptr(e);
18513         CHECK_ACCESS(e_ptr);
18514         LDKSendError e_conv = *(LDKSendError*)(e_ptr);
18515         e_conv = SendError_clone((LDKSendError*)untag_ptr(e));
18516         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
18517         *ret_conv = CResult_NoneSendErrorZ_err(e_conv);
18518         return tag_ptr(ret_conv, true);
18519 }
18520
18521 jboolean  __attribute__((export_name("TS_CResult_NoneSendErrorZ_is_ok"))) TS_CResult_NoneSendErrorZ_is_ok(uint64_t o) {
18522         LDKCResult_NoneSendErrorZ* o_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(o);
18523         jboolean ret_conv = CResult_NoneSendErrorZ_is_ok(o_conv);
18524         return ret_conv;
18525 }
18526
18527 void  __attribute__((export_name("TS_CResult_NoneSendErrorZ_free"))) TS_CResult_NoneSendErrorZ_free(uint64_t _res) {
18528         if (!ptr_is_owned(_res)) return;
18529         void* _res_ptr = untag_ptr(_res);
18530         CHECK_ACCESS(_res_ptr);
18531         LDKCResult_NoneSendErrorZ _res_conv = *(LDKCResult_NoneSendErrorZ*)(_res_ptr);
18532         FREE(untag_ptr(_res));
18533         CResult_NoneSendErrorZ_free(_res_conv);
18534 }
18535
18536 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_ok"))) TS_CResult_u32GraphSyncErrorZ_ok(int32_t o) {
18537         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
18538         *ret_conv = CResult_u32GraphSyncErrorZ_ok(o);
18539         return tag_ptr(ret_conv, true);
18540 }
18541
18542 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_err"))) TS_CResult_u32GraphSyncErrorZ_err(uint64_t e) {
18543         void* e_ptr = untag_ptr(e);
18544         CHECK_ACCESS(e_ptr);
18545         LDKGraphSyncError e_conv = *(LDKGraphSyncError*)(e_ptr);
18546         e_conv = GraphSyncError_clone((LDKGraphSyncError*)untag_ptr(e));
18547         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
18548         *ret_conv = CResult_u32GraphSyncErrorZ_err(e_conv);
18549         return tag_ptr(ret_conv, true);
18550 }
18551
18552 jboolean  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_is_ok"))) TS_CResult_u32GraphSyncErrorZ_is_ok(uint64_t o) {
18553         LDKCResult_u32GraphSyncErrorZ* o_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(o);
18554         jboolean ret_conv = CResult_u32GraphSyncErrorZ_is_ok(o_conv);
18555         return ret_conv;
18556 }
18557
18558 void  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_free"))) TS_CResult_u32GraphSyncErrorZ_free(uint64_t _res) {
18559         if (!ptr_is_owned(_res)) return;
18560         void* _res_ptr = untag_ptr(_res);
18561         CHECK_ACCESS(_res_ptr);
18562         LDKCResult_u32GraphSyncErrorZ _res_conv = *(LDKCResult_u32GraphSyncErrorZ*)(_res_ptr);
18563         FREE(untag_ptr(_res));
18564         CResult_u32GraphSyncErrorZ_free(_res_conv);
18565 }
18566
18567 uint64_t  __attribute__((export_name("TS_CResult_NoneErrorZ_ok"))) TS_CResult_NoneErrorZ_ok() {
18568         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
18569         *ret_conv = CResult_NoneErrorZ_ok();
18570         return tag_ptr(ret_conv, true);
18571 }
18572
18573 uint64_t  __attribute__((export_name("TS_CResult_NoneErrorZ_err"))) TS_CResult_NoneErrorZ_err(uint32_t e) {
18574         LDKIOError e_conv = LDKIOError_from_js(e);
18575         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
18576         *ret_conv = CResult_NoneErrorZ_err(e_conv);
18577         return tag_ptr(ret_conv, true);
18578 }
18579
18580 jboolean  __attribute__((export_name("TS_CResult_NoneErrorZ_is_ok"))) TS_CResult_NoneErrorZ_is_ok(uint64_t o) {
18581         LDKCResult_NoneErrorZ* o_conv = (LDKCResult_NoneErrorZ*)untag_ptr(o);
18582         jboolean ret_conv = CResult_NoneErrorZ_is_ok(o_conv);
18583         return ret_conv;
18584 }
18585
18586 void  __attribute__((export_name("TS_CResult_NoneErrorZ_free"))) TS_CResult_NoneErrorZ_free(uint64_t _res) {
18587         if (!ptr_is_owned(_res)) return;
18588         void* _res_ptr = untag_ptr(_res);
18589         CHECK_ACCESS(_res_ptr);
18590         LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(_res_ptr);
18591         FREE(untag_ptr(_res));
18592         CResult_NoneErrorZ_free(_res_conv);
18593 }
18594
18595 static inline uint64_t CResult_NoneErrorZ_clone_ptr(LDKCResult_NoneErrorZ *NONNULL_PTR arg) {
18596         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
18597         *ret_conv = CResult_NoneErrorZ_clone(arg);
18598         return tag_ptr(ret_conv, true);
18599 }
18600 int64_t  __attribute__((export_name("TS_CResult_NoneErrorZ_clone_ptr"))) TS_CResult_NoneErrorZ_clone_ptr(uint64_t arg) {
18601         LDKCResult_NoneErrorZ* arg_conv = (LDKCResult_NoneErrorZ*)untag_ptr(arg);
18602         int64_t ret_conv = CResult_NoneErrorZ_clone_ptr(arg_conv);
18603         return ret_conv;
18604 }
18605
18606 uint64_t  __attribute__((export_name("TS_CResult_NoneErrorZ_clone"))) TS_CResult_NoneErrorZ_clone(uint64_t orig) {
18607         LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)untag_ptr(orig);
18608         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
18609         *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
18610         return tag_ptr(ret_conv, true);
18611 }
18612
18613 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_ok"))) TS_CResult_NetAddressDecodeErrorZ_ok(uint64_t o) {
18614         void* o_ptr = untag_ptr(o);
18615         CHECK_ACCESS(o_ptr);
18616         LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
18617         o_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o));
18618         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
18619         *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
18620         return tag_ptr(ret_conv, true);
18621 }
18622
18623 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_err"))) TS_CResult_NetAddressDecodeErrorZ_err(uint64_t e) {
18624         LDKDecodeError e_conv;
18625         e_conv.inner = untag_ptr(e);
18626         e_conv.is_owned = ptr_is_owned(e);
18627         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18628         e_conv = DecodeError_clone(&e_conv);
18629         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
18630         *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
18631         return tag_ptr(ret_conv, true);
18632 }
18633
18634 jboolean  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_is_ok"))) TS_CResult_NetAddressDecodeErrorZ_is_ok(uint64_t o) {
18635         LDKCResult_NetAddressDecodeErrorZ* o_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(o);
18636         jboolean ret_conv = CResult_NetAddressDecodeErrorZ_is_ok(o_conv);
18637         return ret_conv;
18638 }
18639
18640 void  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_free"))) TS_CResult_NetAddressDecodeErrorZ_free(uint64_t _res) {
18641         if (!ptr_is_owned(_res)) return;
18642         void* _res_ptr = untag_ptr(_res);
18643         CHECK_ACCESS(_res_ptr);
18644         LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(_res_ptr);
18645         FREE(untag_ptr(_res));
18646         CResult_NetAddressDecodeErrorZ_free(_res_conv);
18647 }
18648
18649 static inline uint64_t CResult_NetAddressDecodeErrorZ_clone_ptr(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR arg) {
18650         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
18651         *ret_conv = CResult_NetAddressDecodeErrorZ_clone(arg);
18652         return tag_ptr(ret_conv, true);
18653 }
18654 int64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_clone_ptr"))) TS_CResult_NetAddressDecodeErrorZ_clone_ptr(uint64_t arg) {
18655         LDKCResult_NetAddressDecodeErrorZ* arg_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(arg);
18656         int64_t ret_conv = CResult_NetAddressDecodeErrorZ_clone_ptr(arg_conv);
18657         return ret_conv;
18658 }
18659
18660 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_clone"))) TS_CResult_NetAddressDecodeErrorZ_clone(uint64_t orig) {
18661         LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(orig);
18662         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
18663         *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
18664         return tag_ptr(ret_conv, true);
18665 }
18666
18667 void  __attribute__((export_name("TS_CVec_UpdateAddHTLCZ_free"))) TS_CVec_UpdateAddHTLCZ_free(uint64_tArray _res) {
18668         LDKCVec_UpdateAddHTLCZ _res_constr;
18669         _res_constr.datalen = _res->arr_len;
18670         if (_res_constr.datalen > 0)
18671                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
18672         else
18673                 _res_constr.data = NULL;
18674         uint64_t* _res_vals = _res->elems;
18675         for (size_t p = 0; p < _res_constr.datalen; p++) {
18676                 uint64_t _res_conv_15 = _res_vals[p];
18677                 LDKUpdateAddHTLC _res_conv_15_conv;
18678                 _res_conv_15_conv.inner = untag_ptr(_res_conv_15);
18679                 _res_conv_15_conv.is_owned = ptr_is_owned(_res_conv_15);
18680                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
18681                 _res_constr.data[p] = _res_conv_15_conv;
18682         }
18683         FREE(_res);
18684         CVec_UpdateAddHTLCZ_free(_res_constr);
18685 }
18686
18687 void  __attribute__((export_name("TS_CVec_UpdateFulfillHTLCZ_free"))) TS_CVec_UpdateFulfillHTLCZ_free(uint64_tArray _res) {
18688         LDKCVec_UpdateFulfillHTLCZ _res_constr;
18689         _res_constr.datalen = _res->arr_len;
18690         if (_res_constr.datalen > 0)
18691                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
18692         else
18693                 _res_constr.data = NULL;
18694         uint64_t* _res_vals = _res->elems;
18695         for (size_t t = 0; t < _res_constr.datalen; t++) {
18696                 uint64_t _res_conv_19 = _res_vals[t];
18697                 LDKUpdateFulfillHTLC _res_conv_19_conv;
18698                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
18699                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
18700                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
18701                 _res_constr.data[t] = _res_conv_19_conv;
18702         }
18703         FREE(_res);
18704         CVec_UpdateFulfillHTLCZ_free(_res_constr);
18705 }
18706
18707 void  __attribute__((export_name("TS_CVec_UpdateFailHTLCZ_free"))) TS_CVec_UpdateFailHTLCZ_free(uint64_tArray _res) {
18708         LDKCVec_UpdateFailHTLCZ _res_constr;
18709         _res_constr.datalen = _res->arr_len;
18710         if (_res_constr.datalen > 0)
18711                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
18712         else
18713                 _res_constr.data = NULL;
18714         uint64_t* _res_vals = _res->elems;
18715         for (size_t q = 0; q < _res_constr.datalen; q++) {
18716                 uint64_t _res_conv_16 = _res_vals[q];
18717                 LDKUpdateFailHTLC _res_conv_16_conv;
18718                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
18719                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
18720                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
18721                 _res_constr.data[q] = _res_conv_16_conv;
18722         }
18723         FREE(_res);
18724         CVec_UpdateFailHTLCZ_free(_res_constr);
18725 }
18726
18727 void  __attribute__((export_name("TS_CVec_UpdateFailMalformedHTLCZ_free"))) TS_CVec_UpdateFailMalformedHTLCZ_free(uint64_tArray _res) {
18728         LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
18729         _res_constr.datalen = _res->arr_len;
18730         if (_res_constr.datalen > 0)
18731                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
18732         else
18733                 _res_constr.data = NULL;
18734         uint64_t* _res_vals = _res->elems;
18735         for (size_t z = 0; z < _res_constr.datalen; z++) {
18736                 uint64_t _res_conv_25 = _res_vals[z];
18737                 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
18738                 _res_conv_25_conv.inner = untag_ptr(_res_conv_25);
18739                 _res_conv_25_conv.is_owned = ptr_is_owned(_res_conv_25);
18740                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
18741                 _res_constr.data[z] = _res_conv_25_conv;
18742         }
18743         FREE(_res);
18744         CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
18745 }
18746
18747 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_ok(uint64_t o) {
18748         LDKAcceptChannel o_conv;
18749         o_conv.inner = untag_ptr(o);
18750         o_conv.is_owned = ptr_is_owned(o);
18751         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18752         o_conv = AcceptChannel_clone(&o_conv);
18753         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
18754         *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
18755         return tag_ptr(ret_conv, true);
18756 }
18757
18758 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_err"))) TS_CResult_AcceptChannelDecodeErrorZ_err(uint64_t e) {
18759         LDKDecodeError e_conv;
18760         e_conv.inner = untag_ptr(e);
18761         e_conv.is_owned = ptr_is_owned(e);
18762         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18763         e_conv = DecodeError_clone(&e_conv);
18764         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
18765         *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
18766         return tag_ptr(ret_conv, true);
18767 }
18768
18769 jboolean  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_is_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_is_ok(uint64_t o) {
18770         LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(o);
18771         jboolean ret_conv = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
18772         return ret_conv;
18773 }
18774
18775 void  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_free"))) TS_CResult_AcceptChannelDecodeErrorZ_free(uint64_t _res) {
18776         if (!ptr_is_owned(_res)) return;
18777         void* _res_ptr = untag_ptr(_res);
18778         CHECK_ACCESS(_res_ptr);
18779         LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
18780         FREE(untag_ptr(_res));
18781         CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
18782 }
18783
18784 static inline uint64_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
18785         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
18786         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
18787         return tag_ptr(ret_conv, true);
18788 }
18789 int64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr"))) TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr(uint64_t arg) {
18790         LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(arg);
18791         int64_t ret_conv = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
18792         return ret_conv;
18793 }
18794
18795 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone"))) TS_CResult_AcceptChannelDecodeErrorZ_clone(uint64_t orig) {
18796         LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(orig);
18797         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
18798         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
18799         return tag_ptr(ret_conv, true);
18800 }
18801
18802 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok(uint64_t o) {
18803         LDKAnnouncementSignatures o_conv;
18804         o_conv.inner = untag_ptr(o);
18805         o_conv.is_owned = ptr_is_owned(o);
18806         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18807         o_conv = AnnouncementSignatures_clone(&o_conv);
18808         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
18809         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
18810         return tag_ptr(ret_conv, true);
18811 }
18812
18813 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_err(uint64_t e) {
18814         LDKDecodeError e_conv;
18815         e_conv.inner = untag_ptr(e);
18816         e_conv.is_owned = ptr_is_owned(e);
18817         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18818         e_conv = DecodeError_clone(&e_conv);
18819         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
18820         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
18821         return tag_ptr(ret_conv, true);
18822 }
18823
18824 jboolean  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(uint64_t o) {
18825         LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(o);
18826         jboolean ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
18827         return ret_conv;
18828 }
18829
18830 void  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_free"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_free(uint64_t _res) {
18831         if (!ptr_is_owned(_res)) return;
18832         void* _res_ptr = untag_ptr(_res);
18833         CHECK_ACCESS(_res_ptr);
18834         LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
18835         FREE(untag_ptr(_res));
18836         CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
18837 }
18838
18839 static inline uint64_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
18840         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
18841         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
18842         return tag_ptr(ret_conv, true);
18843 }
18844 int64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
18845         LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(arg);
18846         int64_t ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
18847         return ret_conv;
18848 }
18849
18850 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone(uint64_t orig) {
18851         LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(orig);
18852         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
18853         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
18854         return tag_ptr(ret_conv, true);
18855 }
18856
18857 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_ok(uint64_t o) {
18858         LDKChannelReestablish o_conv;
18859         o_conv.inner = untag_ptr(o);
18860         o_conv.is_owned = ptr_is_owned(o);
18861         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18862         o_conv = ChannelReestablish_clone(&o_conv);
18863         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
18864         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
18865         return tag_ptr(ret_conv, true);
18866 }
18867
18868 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_err(uint64_t e) {
18869         LDKDecodeError e_conv;
18870         e_conv.inner = untag_ptr(e);
18871         e_conv.is_owned = ptr_is_owned(e);
18872         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18873         e_conv = DecodeError_clone(&e_conv);
18874         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
18875         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
18876         return tag_ptr(ret_conv, true);
18877 }
18878
18879 jboolean  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_is_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_is_ok(uint64_t o) {
18880         LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(o);
18881         jboolean ret_conv = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
18882         return ret_conv;
18883 }
18884
18885 void  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_free"))) TS_CResult_ChannelReestablishDecodeErrorZ_free(uint64_t _res) {
18886         if (!ptr_is_owned(_res)) return;
18887         void* _res_ptr = untag_ptr(_res);
18888         CHECK_ACCESS(_res_ptr);
18889         LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
18890         FREE(untag_ptr(_res));
18891         CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
18892 }
18893
18894 static inline uint64_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
18895         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
18896         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
18897         return tag_ptr(ret_conv, true);
18898 }
18899 int64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr(uint64_t arg) {
18900         LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(arg);
18901         int64_t ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
18902         return ret_conv;
18903 }
18904
18905 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone(uint64_t orig) {
18906         LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(orig);
18907         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
18908         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
18909         return tag_ptr(ret_conv, true);
18910 }
18911
18912 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_ok(uint64_t o) {
18913         LDKClosingSigned o_conv;
18914         o_conv.inner = untag_ptr(o);
18915         o_conv.is_owned = ptr_is_owned(o);
18916         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18917         o_conv = ClosingSigned_clone(&o_conv);
18918         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
18919         *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
18920         return tag_ptr(ret_conv, true);
18921 }
18922
18923 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_err"))) TS_CResult_ClosingSignedDecodeErrorZ_err(uint64_t e) {
18924         LDKDecodeError e_conv;
18925         e_conv.inner = untag_ptr(e);
18926         e_conv.is_owned = ptr_is_owned(e);
18927         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18928         e_conv = DecodeError_clone(&e_conv);
18929         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
18930         *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
18931         return tag_ptr(ret_conv, true);
18932 }
18933
18934 jboolean  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_is_ok(uint64_t o) {
18935         LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(o);
18936         jboolean ret_conv = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
18937         return ret_conv;
18938 }
18939
18940 void  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_free"))) TS_CResult_ClosingSignedDecodeErrorZ_free(uint64_t _res) {
18941         if (!ptr_is_owned(_res)) return;
18942         void* _res_ptr = untag_ptr(_res);
18943         CHECK_ACCESS(_res_ptr);
18944         LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
18945         FREE(untag_ptr(_res));
18946         CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
18947 }
18948
18949 static inline uint64_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
18950         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
18951         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
18952         return tag_ptr(ret_conv, true);
18953 }
18954 int64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
18955         LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(arg);
18956         int64_t ret_conv = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
18957         return ret_conv;
18958 }
18959
18960 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone"))) TS_CResult_ClosingSignedDecodeErrorZ_clone(uint64_t orig) {
18961         LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(orig);
18962         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
18963         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
18964         return tag_ptr(ret_conv, true);
18965 }
18966
18967 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(uint64_t o) {
18968         LDKClosingSignedFeeRange o_conv;
18969         o_conv.inner = untag_ptr(o);
18970         o_conv.is_owned = ptr_is_owned(o);
18971         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18972         o_conv = ClosingSignedFeeRange_clone(&o_conv);
18973         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
18974         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
18975         return tag_ptr(ret_conv, true);
18976 }
18977
18978 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err(uint64_t e) {
18979         LDKDecodeError e_conv;
18980         e_conv.inner = untag_ptr(e);
18981         e_conv.is_owned = ptr_is_owned(e);
18982         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18983         e_conv = DecodeError_clone(&e_conv);
18984         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
18985         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
18986         return tag_ptr(ret_conv, true);
18987 }
18988
18989 jboolean  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(uint64_t o) {
18990         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(o);
18991         jboolean ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
18992         return ret_conv;
18993 }
18994
18995 void  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free(uint64_t _res) {
18996         if (!ptr_is_owned(_res)) return;
18997         void* _res_ptr = untag_ptr(_res);
18998         CHECK_ACCESS(_res_ptr);
18999         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
19000         FREE(untag_ptr(_res));
19001         CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
19002 }
19003
19004 static inline uint64_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
19005         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
19006         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
19007         return tag_ptr(ret_conv, true);
19008 }
19009 int64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
19010         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(arg);
19011         int64_t ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
19012         return ret_conv;
19013 }
19014
19015 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(uint64_t orig) {
19016         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(orig);
19017         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
19018         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
19019         return tag_ptr(ret_conv, true);
19020 }
19021
19022 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_ok(uint64_t o) {
19023         LDKCommitmentSigned o_conv;
19024         o_conv.inner = untag_ptr(o);
19025         o_conv.is_owned = ptr_is_owned(o);
19026         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19027         o_conv = CommitmentSigned_clone(&o_conv);
19028         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
19029         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
19030         return tag_ptr(ret_conv, true);
19031 }
19032
19033 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_err"))) TS_CResult_CommitmentSignedDecodeErrorZ_err(uint64_t e) {
19034         LDKDecodeError e_conv;
19035         e_conv.inner = untag_ptr(e);
19036         e_conv.is_owned = ptr_is_owned(e);
19037         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19038         e_conv = DecodeError_clone(&e_conv);
19039         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
19040         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
19041         return tag_ptr(ret_conv, true);
19042 }
19043
19044 jboolean  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_is_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_is_ok(uint64_t o) {
19045         LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(o);
19046         jboolean ret_conv = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
19047         return ret_conv;
19048 }
19049
19050 void  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_free"))) TS_CResult_CommitmentSignedDecodeErrorZ_free(uint64_t _res) {
19051         if (!ptr_is_owned(_res)) return;
19052         void* _res_ptr = untag_ptr(_res);
19053         CHECK_ACCESS(_res_ptr);
19054         LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
19055         FREE(untag_ptr(_res));
19056         CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
19057 }
19058
19059 static inline uint64_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
19060         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
19061         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
19062         return tag_ptr(ret_conv, true);
19063 }
19064 int64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
19065         LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(arg);
19066         int64_t ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
19067         return ret_conv;
19068 }
19069
19070 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone(uint64_t orig) {
19071         LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(orig);
19072         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
19073         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
19074         return tag_ptr(ret_conv, true);
19075 }
19076
19077 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_ok(uint64_t o) {
19078         LDKFundingCreated o_conv;
19079         o_conv.inner = untag_ptr(o);
19080         o_conv.is_owned = ptr_is_owned(o);
19081         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19082         o_conv = FundingCreated_clone(&o_conv);
19083         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
19084         *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
19085         return tag_ptr(ret_conv, true);
19086 }
19087
19088 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_err"))) TS_CResult_FundingCreatedDecodeErrorZ_err(uint64_t e) {
19089         LDKDecodeError e_conv;
19090         e_conv.inner = untag_ptr(e);
19091         e_conv.is_owned = ptr_is_owned(e);
19092         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19093         e_conv = DecodeError_clone(&e_conv);
19094         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
19095         *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
19096         return tag_ptr(ret_conv, true);
19097 }
19098
19099 jboolean  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_is_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_is_ok(uint64_t o) {
19100         LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(o);
19101         jboolean ret_conv = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
19102         return ret_conv;
19103 }
19104
19105 void  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_free"))) TS_CResult_FundingCreatedDecodeErrorZ_free(uint64_t _res) {
19106         if (!ptr_is_owned(_res)) return;
19107         void* _res_ptr = untag_ptr(_res);
19108         CHECK_ACCESS(_res_ptr);
19109         LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
19110         FREE(untag_ptr(_res));
19111         CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
19112 }
19113
19114 static inline uint64_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
19115         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
19116         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
19117         return tag_ptr(ret_conv, true);
19118 }
19119 int64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr(uint64_t arg) {
19120         LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(arg);
19121         int64_t ret_conv = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
19122         return ret_conv;
19123 }
19124
19125 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone"))) TS_CResult_FundingCreatedDecodeErrorZ_clone(uint64_t orig) {
19126         LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(orig);
19127         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
19128         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
19129         return tag_ptr(ret_conv, true);
19130 }
19131
19132 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_ok"))) TS_CResult_FundingSignedDecodeErrorZ_ok(uint64_t o) {
19133         LDKFundingSigned o_conv;
19134         o_conv.inner = untag_ptr(o);
19135         o_conv.is_owned = ptr_is_owned(o);
19136         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19137         o_conv = FundingSigned_clone(&o_conv);
19138         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
19139         *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
19140         return tag_ptr(ret_conv, true);
19141 }
19142
19143 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_err"))) TS_CResult_FundingSignedDecodeErrorZ_err(uint64_t e) {
19144         LDKDecodeError e_conv;
19145         e_conv.inner = untag_ptr(e);
19146         e_conv.is_owned = ptr_is_owned(e);
19147         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19148         e_conv = DecodeError_clone(&e_conv);
19149         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
19150         *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
19151         return tag_ptr(ret_conv, true);
19152 }
19153
19154 jboolean  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_is_ok"))) TS_CResult_FundingSignedDecodeErrorZ_is_ok(uint64_t o) {
19155         LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(o);
19156         jboolean ret_conv = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
19157         return ret_conv;
19158 }
19159
19160 void  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_free"))) TS_CResult_FundingSignedDecodeErrorZ_free(uint64_t _res) {
19161         if (!ptr_is_owned(_res)) return;
19162         void* _res_ptr = untag_ptr(_res);
19163         CHECK_ACCESS(_res_ptr);
19164         LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
19165         FREE(untag_ptr(_res));
19166         CResult_FundingSignedDecodeErrorZ_free(_res_conv);
19167 }
19168
19169 static inline uint64_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
19170         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
19171         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
19172         return tag_ptr(ret_conv, true);
19173 }
19174 int64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
19175         LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(arg);
19176         int64_t ret_conv = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
19177         return ret_conv;
19178 }
19179
19180 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone"))) TS_CResult_FundingSignedDecodeErrorZ_clone(uint64_t orig) {
19181         LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(orig);
19182         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
19183         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
19184         return tag_ptr(ret_conv, true);
19185 }
19186
19187 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_ok(uint64_t o) {
19188         LDKChannelReady o_conv;
19189         o_conv.inner = untag_ptr(o);
19190         o_conv.is_owned = ptr_is_owned(o);
19191         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19192         o_conv = ChannelReady_clone(&o_conv);
19193         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
19194         *ret_conv = CResult_ChannelReadyDecodeErrorZ_ok(o_conv);
19195         return tag_ptr(ret_conv, true);
19196 }
19197
19198 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_err"))) TS_CResult_ChannelReadyDecodeErrorZ_err(uint64_t e) {
19199         LDKDecodeError e_conv;
19200         e_conv.inner = untag_ptr(e);
19201         e_conv.is_owned = ptr_is_owned(e);
19202         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19203         e_conv = DecodeError_clone(&e_conv);
19204         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
19205         *ret_conv = CResult_ChannelReadyDecodeErrorZ_err(e_conv);
19206         return tag_ptr(ret_conv, true);
19207 }
19208
19209 jboolean  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_is_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_is_ok(uint64_t o) {
19210         LDKCResult_ChannelReadyDecodeErrorZ* o_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(o);
19211         jboolean ret_conv = CResult_ChannelReadyDecodeErrorZ_is_ok(o_conv);
19212         return ret_conv;
19213 }
19214
19215 void  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_free"))) TS_CResult_ChannelReadyDecodeErrorZ_free(uint64_t _res) {
19216         if (!ptr_is_owned(_res)) return;
19217         void* _res_ptr = untag_ptr(_res);
19218         CHECK_ACCESS(_res_ptr);
19219         LDKCResult_ChannelReadyDecodeErrorZ _res_conv = *(LDKCResult_ChannelReadyDecodeErrorZ*)(_res_ptr);
19220         FREE(untag_ptr(_res));
19221         CResult_ChannelReadyDecodeErrorZ_free(_res_conv);
19222 }
19223
19224 static inline uint64_t CResult_ChannelReadyDecodeErrorZ_clone_ptr(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR arg) {
19225         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
19226         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(arg);
19227         return tag_ptr(ret_conv, true);
19228 }
19229 int64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelReadyDecodeErrorZ_clone_ptr(uint64_t arg) {
19230         LDKCResult_ChannelReadyDecodeErrorZ* arg_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(arg);
19231         int64_t ret_conv = CResult_ChannelReadyDecodeErrorZ_clone_ptr(arg_conv);
19232         return ret_conv;
19233 }
19234
19235 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_clone"))) TS_CResult_ChannelReadyDecodeErrorZ_clone(uint64_t orig) {
19236         LDKCResult_ChannelReadyDecodeErrorZ* orig_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(orig);
19237         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
19238         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(orig_conv);
19239         return tag_ptr(ret_conv, true);
19240 }
19241
19242 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_ok"))) TS_CResult_InitDecodeErrorZ_ok(uint64_t o) {
19243         LDKInit o_conv;
19244         o_conv.inner = untag_ptr(o);
19245         o_conv.is_owned = ptr_is_owned(o);
19246         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19247         o_conv = Init_clone(&o_conv);
19248         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
19249         *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
19250         return tag_ptr(ret_conv, true);
19251 }
19252
19253 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_err"))) TS_CResult_InitDecodeErrorZ_err(uint64_t e) {
19254         LDKDecodeError e_conv;
19255         e_conv.inner = untag_ptr(e);
19256         e_conv.is_owned = ptr_is_owned(e);
19257         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19258         e_conv = DecodeError_clone(&e_conv);
19259         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
19260         *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
19261         return tag_ptr(ret_conv, true);
19262 }
19263
19264 jboolean  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_is_ok"))) TS_CResult_InitDecodeErrorZ_is_ok(uint64_t o) {
19265         LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(o);
19266         jboolean ret_conv = CResult_InitDecodeErrorZ_is_ok(o_conv);
19267         return ret_conv;
19268 }
19269
19270 void  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_free"))) TS_CResult_InitDecodeErrorZ_free(uint64_t _res) {
19271         if (!ptr_is_owned(_res)) return;
19272         void* _res_ptr = untag_ptr(_res);
19273         CHECK_ACCESS(_res_ptr);
19274         LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
19275         FREE(untag_ptr(_res));
19276         CResult_InitDecodeErrorZ_free(_res_conv);
19277 }
19278
19279 static inline uint64_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
19280         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
19281         *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
19282         return tag_ptr(ret_conv, true);
19283 }
19284 int64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone_ptr"))) TS_CResult_InitDecodeErrorZ_clone_ptr(uint64_t arg) {
19285         LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(arg);
19286         int64_t ret_conv = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
19287         return ret_conv;
19288 }
19289
19290 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone"))) TS_CResult_InitDecodeErrorZ_clone(uint64_t orig) {
19291         LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(orig);
19292         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
19293         *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
19294         return tag_ptr(ret_conv, true);
19295 }
19296
19297 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_ok"))) TS_CResult_OpenChannelDecodeErrorZ_ok(uint64_t o) {
19298         LDKOpenChannel o_conv;
19299         o_conv.inner = untag_ptr(o);
19300         o_conv.is_owned = ptr_is_owned(o);
19301         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19302         o_conv = OpenChannel_clone(&o_conv);
19303         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
19304         *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
19305         return tag_ptr(ret_conv, true);
19306 }
19307
19308 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_err"))) TS_CResult_OpenChannelDecodeErrorZ_err(uint64_t e) {
19309         LDKDecodeError e_conv;
19310         e_conv.inner = untag_ptr(e);
19311         e_conv.is_owned = ptr_is_owned(e);
19312         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19313         e_conv = DecodeError_clone(&e_conv);
19314         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
19315         *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
19316         return tag_ptr(ret_conv, true);
19317 }
19318
19319 jboolean  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_is_ok"))) TS_CResult_OpenChannelDecodeErrorZ_is_ok(uint64_t o) {
19320         LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(o);
19321         jboolean ret_conv = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
19322         return ret_conv;
19323 }
19324
19325 void  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_free"))) TS_CResult_OpenChannelDecodeErrorZ_free(uint64_t _res) {
19326         if (!ptr_is_owned(_res)) return;
19327         void* _res_ptr = untag_ptr(_res);
19328         CHECK_ACCESS(_res_ptr);
19329         LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
19330         FREE(untag_ptr(_res));
19331         CResult_OpenChannelDecodeErrorZ_free(_res_conv);
19332 }
19333
19334 static inline uint64_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
19335         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
19336         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
19337         return tag_ptr(ret_conv, true);
19338 }
19339 int64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone_ptr"))) TS_CResult_OpenChannelDecodeErrorZ_clone_ptr(uint64_t arg) {
19340         LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(arg);
19341         int64_t ret_conv = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
19342         return ret_conv;
19343 }
19344
19345 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone"))) TS_CResult_OpenChannelDecodeErrorZ_clone(uint64_t orig) {
19346         LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(orig);
19347         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
19348         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
19349         return tag_ptr(ret_conv, true);
19350 }
19351
19352 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_ok(uint64_t o) {
19353         LDKRevokeAndACK o_conv;
19354         o_conv.inner = untag_ptr(o);
19355         o_conv.is_owned = ptr_is_owned(o);
19356         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19357         o_conv = RevokeAndACK_clone(&o_conv);
19358         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
19359         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
19360         return tag_ptr(ret_conv, true);
19361 }
19362
19363 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_err"))) TS_CResult_RevokeAndACKDecodeErrorZ_err(uint64_t e) {
19364         LDKDecodeError e_conv;
19365         e_conv.inner = untag_ptr(e);
19366         e_conv.is_owned = ptr_is_owned(e);
19367         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19368         e_conv = DecodeError_clone(&e_conv);
19369         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
19370         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
19371         return tag_ptr(ret_conv, true);
19372 }
19373
19374 jboolean  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_is_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_is_ok(uint64_t o) {
19375         LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(o);
19376         jboolean ret_conv = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
19377         return ret_conv;
19378 }
19379
19380 void  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_free"))) TS_CResult_RevokeAndACKDecodeErrorZ_free(uint64_t _res) {
19381         if (!ptr_is_owned(_res)) return;
19382         void* _res_ptr = untag_ptr(_res);
19383         CHECK_ACCESS(_res_ptr);
19384         LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
19385         FREE(untag_ptr(_res));
19386         CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
19387 }
19388
19389 static inline uint64_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
19390         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
19391         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
19392         return tag_ptr(ret_conv, true);
19393 }
19394 int64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr(uint64_t arg) {
19395         LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(arg);
19396         int64_t ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
19397         return ret_conv;
19398 }
19399
19400 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone(uint64_t orig) {
19401         LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(orig);
19402         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
19403         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
19404         return tag_ptr(ret_conv, true);
19405 }
19406
19407 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_ok"))) TS_CResult_ShutdownDecodeErrorZ_ok(uint64_t o) {
19408         LDKShutdown o_conv;
19409         o_conv.inner = untag_ptr(o);
19410         o_conv.is_owned = ptr_is_owned(o);
19411         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19412         o_conv = Shutdown_clone(&o_conv);
19413         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
19414         *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
19415         return tag_ptr(ret_conv, true);
19416 }
19417
19418 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_err"))) TS_CResult_ShutdownDecodeErrorZ_err(uint64_t e) {
19419         LDKDecodeError e_conv;
19420         e_conv.inner = untag_ptr(e);
19421         e_conv.is_owned = ptr_is_owned(e);
19422         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19423         e_conv = DecodeError_clone(&e_conv);
19424         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
19425         *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
19426         return tag_ptr(ret_conv, true);
19427 }
19428
19429 jboolean  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_is_ok"))) TS_CResult_ShutdownDecodeErrorZ_is_ok(uint64_t o) {
19430         LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(o);
19431         jboolean ret_conv = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
19432         return ret_conv;
19433 }
19434
19435 void  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_free"))) TS_CResult_ShutdownDecodeErrorZ_free(uint64_t _res) {
19436         if (!ptr_is_owned(_res)) return;
19437         void* _res_ptr = untag_ptr(_res);
19438         CHECK_ACCESS(_res_ptr);
19439         LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
19440         FREE(untag_ptr(_res));
19441         CResult_ShutdownDecodeErrorZ_free(_res_conv);
19442 }
19443
19444 static inline uint64_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
19445         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
19446         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
19447         return tag_ptr(ret_conv, true);
19448 }
19449 int64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone_ptr"))) TS_CResult_ShutdownDecodeErrorZ_clone_ptr(uint64_t arg) {
19450         LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(arg);
19451         int64_t ret_conv = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
19452         return ret_conv;
19453 }
19454
19455 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone"))) TS_CResult_ShutdownDecodeErrorZ_clone(uint64_t orig) {
19456         LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(orig);
19457         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
19458         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
19459         return tag_ptr(ret_conv, true);
19460 }
19461
19462 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_ok(uint64_t o) {
19463         LDKUpdateFailHTLC o_conv;
19464         o_conv.inner = untag_ptr(o);
19465         o_conv.is_owned = ptr_is_owned(o);
19466         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19467         o_conv = UpdateFailHTLC_clone(&o_conv);
19468         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
19469         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
19470         return tag_ptr(ret_conv, true);
19471 }
19472
19473 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_err(uint64_t e) {
19474         LDKDecodeError e_conv;
19475         e_conv.inner = untag_ptr(e);
19476         e_conv.is_owned = ptr_is_owned(e);
19477         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19478         e_conv = DecodeError_clone(&e_conv);
19479         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
19480         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
19481         return tag_ptr(ret_conv, true);
19482 }
19483
19484 jboolean  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok(uint64_t o) {
19485         LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(o);
19486         jboolean ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
19487         return ret_conv;
19488 }
19489
19490 void  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_free(uint64_t _res) {
19491         if (!ptr_is_owned(_res)) return;
19492         void* _res_ptr = untag_ptr(_res);
19493         CHECK_ACCESS(_res_ptr);
19494         LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
19495         FREE(untag_ptr(_res));
19496         CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
19497 }
19498
19499 static inline uint64_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
19500         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
19501         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
19502         return tag_ptr(ret_conv, true);
19503 }
19504 int64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
19505         LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(arg);
19506         int64_t ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
19507         return ret_conv;
19508 }
19509
19510 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone(uint64_t orig) {
19511         LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(orig);
19512         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
19513         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
19514         return tag_ptr(ret_conv, true);
19515 }
19516
19517 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(uint64_t o) {
19518         LDKUpdateFailMalformedHTLC o_conv;
19519         o_conv.inner = untag_ptr(o);
19520         o_conv.is_owned = ptr_is_owned(o);
19521         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19522         o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
19523         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
19524         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
19525         return tag_ptr(ret_conv, true);
19526 }
19527
19528 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(uint64_t e) {
19529         LDKDecodeError e_conv;
19530         e_conv.inner = untag_ptr(e);
19531         e_conv.is_owned = ptr_is_owned(e);
19532         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19533         e_conv = DecodeError_clone(&e_conv);
19534         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
19535         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
19536         return tag_ptr(ret_conv, true);
19537 }
19538
19539 jboolean  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(uint64_t o) {
19540         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(o);
19541         jboolean ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
19542         return ret_conv;
19543 }
19544
19545 void  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(uint64_t _res) {
19546         if (!ptr_is_owned(_res)) return;
19547         void* _res_ptr = untag_ptr(_res);
19548         CHECK_ACCESS(_res_ptr);
19549         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
19550         FREE(untag_ptr(_res));
19551         CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
19552 }
19553
19554 static inline uint64_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
19555         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
19556         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
19557         return tag_ptr(ret_conv, true);
19558 }
19559 int64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
19560         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(arg);
19561         int64_t ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
19562         return ret_conv;
19563 }
19564
19565 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(uint64_t orig) {
19566         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(orig);
19567         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
19568         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
19569         return tag_ptr(ret_conv, true);
19570 }
19571
19572 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_ok(uint64_t o) {
19573         LDKUpdateFee o_conv;
19574         o_conv.inner = untag_ptr(o);
19575         o_conv.is_owned = ptr_is_owned(o);
19576         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19577         o_conv = UpdateFee_clone(&o_conv);
19578         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
19579         *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
19580         return tag_ptr(ret_conv, true);
19581 }
19582
19583 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_err"))) TS_CResult_UpdateFeeDecodeErrorZ_err(uint64_t e) {
19584         LDKDecodeError e_conv;
19585         e_conv.inner = untag_ptr(e);
19586         e_conv.is_owned = ptr_is_owned(e);
19587         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19588         e_conv = DecodeError_clone(&e_conv);
19589         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
19590         *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
19591         return tag_ptr(ret_conv, true);
19592 }
19593
19594 jboolean  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_is_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_is_ok(uint64_t o) {
19595         LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(o);
19596         jboolean ret_conv = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
19597         return ret_conv;
19598 }
19599
19600 void  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_free"))) TS_CResult_UpdateFeeDecodeErrorZ_free(uint64_t _res) {
19601         if (!ptr_is_owned(_res)) return;
19602         void* _res_ptr = untag_ptr(_res);
19603         CHECK_ACCESS(_res_ptr);
19604         LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
19605         FREE(untag_ptr(_res));
19606         CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
19607 }
19608
19609 static inline uint64_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
19610         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
19611         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
19612         return tag_ptr(ret_conv, true);
19613 }
19614 int64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr(uint64_t arg) {
19615         LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(arg);
19616         int64_t ret_conv = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
19617         return ret_conv;
19618 }
19619
19620 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone"))) TS_CResult_UpdateFeeDecodeErrorZ_clone(uint64_t orig) {
19621         LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(orig);
19622         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
19623         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
19624         return tag_ptr(ret_conv, true);
19625 }
19626
19627 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok(uint64_t o) {
19628         LDKUpdateFulfillHTLC o_conv;
19629         o_conv.inner = untag_ptr(o);
19630         o_conv.is_owned = ptr_is_owned(o);
19631         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19632         o_conv = UpdateFulfillHTLC_clone(&o_conv);
19633         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
19634         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
19635         return tag_ptr(ret_conv, true);
19636 }
19637
19638 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err(uint64_t e) {
19639         LDKDecodeError e_conv;
19640         e_conv.inner = untag_ptr(e);
19641         e_conv.is_owned = ptr_is_owned(e);
19642         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19643         e_conv = DecodeError_clone(&e_conv);
19644         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
19645         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
19646         return tag_ptr(ret_conv, true);
19647 }
19648
19649 jboolean  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(uint64_t o) {
19650         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(o);
19651         jboolean ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
19652         return ret_conv;
19653 }
19654
19655 void  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free(uint64_t _res) {
19656         if (!ptr_is_owned(_res)) return;
19657         void* _res_ptr = untag_ptr(_res);
19658         CHECK_ACCESS(_res_ptr);
19659         LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
19660         FREE(untag_ptr(_res));
19661         CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
19662 }
19663
19664 static inline uint64_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
19665         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
19666         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
19667         return tag_ptr(ret_conv, true);
19668 }
19669 int64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
19670         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(arg);
19671         int64_t ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
19672         return ret_conv;
19673 }
19674
19675 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone(uint64_t orig) {
19676         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(orig);
19677         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
19678         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
19679         return tag_ptr(ret_conv, true);
19680 }
19681
19682 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_ok(uint64_t o) {
19683         LDKUpdateAddHTLC o_conv;
19684         o_conv.inner = untag_ptr(o);
19685         o_conv.is_owned = ptr_is_owned(o);
19686         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19687         o_conv = UpdateAddHTLC_clone(&o_conv);
19688         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
19689         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
19690         return tag_ptr(ret_conv, true);
19691 }
19692
19693 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_err"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_err(uint64_t e) {
19694         LDKDecodeError e_conv;
19695         e_conv.inner = untag_ptr(e);
19696         e_conv.is_owned = ptr_is_owned(e);
19697         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19698         e_conv = DecodeError_clone(&e_conv);
19699         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
19700         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
19701         return tag_ptr(ret_conv, true);
19702 }
19703
19704 jboolean  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok(uint64_t o) {
19705         LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(o);
19706         jboolean ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
19707         return ret_conv;
19708 }
19709
19710 void  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_free"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_free(uint64_t _res) {
19711         if (!ptr_is_owned(_res)) return;
19712         void* _res_ptr = untag_ptr(_res);
19713         CHECK_ACCESS(_res_ptr);
19714         LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
19715         FREE(untag_ptr(_res));
19716         CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
19717 }
19718
19719 static inline uint64_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
19720         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
19721         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
19722         return tag_ptr(ret_conv, true);
19723 }
19724 int64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
19725         LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(arg);
19726         int64_t ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
19727         return ret_conv;
19728 }
19729
19730 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone(uint64_t orig) {
19731         LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(orig);
19732         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
19733         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
19734         return tag_ptr(ret_conv, true);
19735 }
19736
19737 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_ok"))) TS_CResult_OnionMessageDecodeErrorZ_ok(uint64_t o) {
19738         LDKOnionMessage o_conv;
19739         o_conv.inner = untag_ptr(o);
19740         o_conv.is_owned = ptr_is_owned(o);
19741         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19742         o_conv = OnionMessage_clone(&o_conv);
19743         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
19744         *ret_conv = CResult_OnionMessageDecodeErrorZ_ok(o_conv);
19745         return tag_ptr(ret_conv, true);
19746 }
19747
19748 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_err"))) TS_CResult_OnionMessageDecodeErrorZ_err(uint64_t e) {
19749         LDKDecodeError e_conv;
19750         e_conv.inner = untag_ptr(e);
19751         e_conv.is_owned = ptr_is_owned(e);
19752         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19753         e_conv = DecodeError_clone(&e_conv);
19754         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
19755         *ret_conv = CResult_OnionMessageDecodeErrorZ_err(e_conv);
19756         return tag_ptr(ret_conv, true);
19757 }
19758
19759 jboolean  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_is_ok"))) TS_CResult_OnionMessageDecodeErrorZ_is_ok(uint64_t o) {
19760         LDKCResult_OnionMessageDecodeErrorZ* o_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(o);
19761         jboolean ret_conv = CResult_OnionMessageDecodeErrorZ_is_ok(o_conv);
19762         return ret_conv;
19763 }
19764
19765 void  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_free"))) TS_CResult_OnionMessageDecodeErrorZ_free(uint64_t _res) {
19766         if (!ptr_is_owned(_res)) return;
19767         void* _res_ptr = untag_ptr(_res);
19768         CHECK_ACCESS(_res_ptr);
19769         LDKCResult_OnionMessageDecodeErrorZ _res_conv = *(LDKCResult_OnionMessageDecodeErrorZ*)(_res_ptr);
19770         FREE(untag_ptr(_res));
19771         CResult_OnionMessageDecodeErrorZ_free(_res_conv);
19772 }
19773
19774 static inline uint64_t CResult_OnionMessageDecodeErrorZ_clone_ptr(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR arg) {
19775         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
19776         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(arg);
19777         return tag_ptr(ret_conv, true);
19778 }
19779 int64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_clone_ptr"))) TS_CResult_OnionMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
19780         LDKCResult_OnionMessageDecodeErrorZ* arg_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(arg);
19781         int64_t ret_conv = CResult_OnionMessageDecodeErrorZ_clone_ptr(arg_conv);
19782         return ret_conv;
19783 }
19784
19785 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_clone"))) TS_CResult_OnionMessageDecodeErrorZ_clone(uint64_t orig) {
19786         LDKCResult_OnionMessageDecodeErrorZ* orig_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(orig);
19787         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
19788         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(orig_conv);
19789         return tag_ptr(ret_conv, true);
19790 }
19791
19792 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_ok"))) TS_CResult_PingDecodeErrorZ_ok(uint64_t o) {
19793         LDKPing o_conv;
19794         o_conv.inner = untag_ptr(o);
19795         o_conv.is_owned = ptr_is_owned(o);
19796         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19797         o_conv = Ping_clone(&o_conv);
19798         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
19799         *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
19800         return tag_ptr(ret_conv, true);
19801 }
19802
19803 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_err"))) TS_CResult_PingDecodeErrorZ_err(uint64_t e) {
19804         LDKDecodeError e_conv;
19805         e_conv.inner = untag_ptr(e);
19806         e_conv.is_owned = ptr_is_owned(e);
19807         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19808         e_conv = DecodeError_clone(&e_conv);
19809         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
19810         *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
19811         return tag_ptr(ret_conv, true);
19812 }
19813
19814 jboolean  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_is_ok"))) TS_CResult_PingDecodeErrorZ_is_ok(uint64_t o) {
19815         LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(o);
19816         jboolean ret_conv = CResult_PingDecodeErrorZ_is_ok(o_conv);
19817         return ret_conv;
19818 }
19819
19820 void  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_free"))) TS_CResult_PingDecodeErrorZ_free(uint64_t _res) {
19821         if (!ptr_is_owned(_res)) return;
19822         void* _res_ptr = untag_ptr(_res);
19823         CHECK_ACCESS(_res_ptr);
19824         LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
19825         FREE(untag_ptr(_res));
19826         CResult_PingDecodeErrorZ_free(_res_conv);
19827 }
19828
19829 static inline uint64_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
19830         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
19831         *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
19832         return tag_ptr(ret_conv, true);
19833 }
19834 int64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone_ptr"))) TS_CResult_PingDecodeErrorZ_clone_ptr(uint64_t arg) {
19835         LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(arg);
19836         int64_t ret_conv = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
19837         return ret_conv;
19838 }
19839
19840 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone"))) TS_CResult_PingDecodeErrorZ_clone(uint64_t orig) {
19841         LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(orig);
19842         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
19843         *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
19844         return tag_ptr(ret_conv, true);
19845 }
19846
19847 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_ok"))) TS_CResult_PongDecodeErrorZ_ok(uint64_t o) {
19848         LDKPong o_conv;
19849         o_conv.inner = untag_ptr(o);
19850         o_conv.is_owned = ptr_is_owned(o);
19851         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19852         o_conv = Pong_clone(&o_conv);
19853         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
19854         *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
19855         return tag_ptr(ret_conv, true);
19856 }
19857
19858 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_err"))) TS_CResult_PongDecodeErrorZ_err(uint64_t e) {
19859         LDKDecodeError e_conv;
19860         e_conv.inner = untag_ptr(e);
19861         e_conv.is_owned = ptr_is_owned(e);
19862         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19863         e_conv = DecodeError_clone(&e_conv);
19864         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
19865         *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
19866         return tag_ptr(ret_conv, true);
19867 }
19868
19869 jboolean  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_is_ok"))) TS_CResult_PongDecodeErrorZ_is_ok(uint64_t o) {
19870         LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(o);
19871         jboolean ret_conv = CResult_PongDecodeErrorZ_is_ok(o_conv);
19872         return ret_conv;
19873 }
19874
19875 void  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_free"))) TS_CResult_PongDecodeErrorZ_free(uint64_t _res) {
19876         if (!ptr_is_owned(_res)) return;
19877         void* _res_ptr = untag_ptr(_res);
19878         CHECK_ACCESS(_res_ptr);
19879         LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
19880         FREE(untag_ptr(_res));
19881         CResult_PongDecodeErrorZ_free(_res_conv);
19882 }
19883
19884 static inline uint64_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
19885         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
19886         *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
19887         return tag_ptr(ret_conv, true);
19888 }
19889 int64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone_ptr"))) TS_CResult_PongDecodeErrorZ_clone_ptr(uint64_t arg) {
19890         LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(arg);
19891         int64_t ret_conv = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
19892         return ret_conv;
19893 }
19894
19895 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone"))) TS_CResult_PongDecodeErrorZ_clone(uint64_t orig) {
19896         LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(orig);
19897         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
19898         *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
19899         return tag_ptr(ret_conv, true);
19900 }
19901
19902 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(uint64_t o) {
19903         LDKUnsignedChannelAnnouncement o_conv;
19904         o_conv.inner = untag_ptr(o);
19905         o_conv.is_owned = ptr_is_owned(o);
19906         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19907         o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
19908         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
19909         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
19910         return tag_ptr(ret_conv, true);
19911 }
19912
19913 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(uint64_t e) {
19914         LDKDecodeError e_conv;
19915         e_conv.inner = untag_ptr(e);
19916         e_conv.is_owned = ptr_is_owned(e);
19917         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19918         e_conv = DecodeError_clone(&e_conv);
19919         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
19920         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
19921         return tag_ptr(ret_conv, true);
19922 }
19923
19924 jboolean  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
19925         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
19926         jboolean ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
19927         return ret_conv;
19928 }
19929
19930 void  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(uint64_t _res) {
19931         if (!ptr_is_owned(_res)) return;
19932         void* _res_ptr = untag_ptr(_res);
19933         CHECK_ACCESS(_res_ptr);
19934         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
19935         FREE(untag_ptr(_res));
19936         CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
19937 }
19938
19939 static inline uint64_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
19940         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
19941         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
19942         return tag_ptr(ret_conv, true);
19943 }
19944 int64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
19945         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
19946         int64_t ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
19947         return ret_conv;
19948 }
19949
19950 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(uint64_t orig) {
19951         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
19952         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
19953         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
19954         return tag_ptr(ret_conv, true);
19955 }
19956
19957 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_ok(uint64_t o) {
19958         LDKChannelAnnouncement o_conv;
19959         o_conv.inner = untag_ptr(o);
19960         o_conv.is_owned = ptr_is_owned(o);
19961         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19962         o_conv = ChannelAnnouncement_clone(&o_conv);
19963         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
19964         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
19965         return tag_ptr(ret_conv, true);
19966 }
19967
19968 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_err(uint64_t e) {
19969         LDKDecodeError e_conv;
19970         e_conv.inner = untag_ptr(e);
19971         e_conv.is_owned = ptr_is_owned(e);
19972         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19973         e_conv = DecodeError_clone(&e_conv);
19974         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
19975         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
19976         return tag_ptr(ret_conv, true);
19977 }
19978
19979 jboolean  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
19980         LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
19981         jboolean ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
19982         return ret_conv;
19983 }
19984
19985 void  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_free(uint64_t _res) {
19986         if (!ptr_is_owned(_res)) return;
19987         void* _res_ptr = untag_ptr(_res);
19988         CHECK_ACCESS(_res_ptr);
19989         LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
19990         FREE(untag_ptr(_res));
19991         CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
19992 }
19993
19994 static inline uint64_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
19995         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
19996         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
19997         return tag_ptr(ret_conv, true);
19998 }
19999 int64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
20000         LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
20001         int64_t ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
20002         return ret_conv;
20003 }
20004
20005 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone(uint64_t orig) {
20006         LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
20007         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
20008         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
20009         return tag_ptr(ret_conv, true);
20010 }
20011
20012 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok(uint64_t o) {
20013         LDKUnsignedChannelUpdate o_conv;
20014         o_conv.inner = untag_ptr(o);
20015         o_conv.is_owned = ptr_is_owned(o);
20016         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20017         o_conv = UnsignedChannelUpdate_clone(&o_conv);
20018         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
20019         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
20020         return tag_ptr(ret_conv, true);
20021 }
20022
20023 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err(uint64_t e) {
20024         LDKDecodeError e_conv;
20025         e_conv.inner = untag_ptr(e);
20026         e_conv.is_owned = ptr_is_owned(e);
20027         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20028         e_conv = DecodeError_clone(&e_conv);
20029         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
20030         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
20031         return tag_ptr(ret_conv, true);
20032 }
20033
20034 jboolean  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(uint64_t o) {
20035         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(o);
20036         jboolean ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
20037         return ret_conv;
20038 }
20039
20040 void  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free(uint64_t _res) {
20041         if (!ptr_is_owned(_res)) return;
20042         void* _res_ptr = untag_ptr(_res);
20043         CHECK_ACCESS(_res_ptr);
20044         LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
20045         FREE(untag_ptr(_res));
20046         CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
20047 }
20048
20049 static inline uint64_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
20050         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
20051         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
20052         return tag_ptr(ret_conv, true);
20053 }
20054 int64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
20055         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(arg);
20056         int64_t ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
20057         return ret_conv;
20058 }
20059
20060 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone(uint64_t orig) {
20061         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(orig);
20062         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
20063         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
20064         return tag_ptr(ret_conv, true);
20065 }
20066
20067 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_ok(uint64_t o) {
20068         LDKChannelUpdate o_conv;
20069         o_conv.inner = untag_ptr(o);
20070         o_conv.is_owned = ptr_is_owned(o);
20071         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20072         o_conv = ChannelUpdate_clone(&o_conv);
20073         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
20074         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
20075         return tag_ptr(ret_conv, true);
20076 }
20077
20078 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_err"))) TS_CResult_ChannelUpdateDecodeErrorZ_err(uint64_t e) {
20079         LDKDecodeError e_conv;
20080         e_conv.inner = untag_ptr(e);
20081         e_conv.is_owned = ptr_is_owned(e);
20082         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20083         e_conv = DecodeError_clone(&e_conv);
20084         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
20085         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
20086         return tag_ptr(ret_conv, true);
20087 }
20088
20089 jboolean  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_is_ok(uint64_t o) {
20090         LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(o);
20091         jboolean ret_conv = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
20092         return ret_conv;
20093 }
20094
20095 void  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_free"))) TS_CResult_ChannelUpdateDecodeErrorZ_free(uint64_t _res) {
20096         if (!ptr_is_owned(_res)) return;
20097         void* _res_ptr = untag_ptr(_res);
20098         CHECK_ACCESS(_res_ptr);
20099         LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
20100         FREE(untag_ptr(_res));
20101         CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
20102 }
20103
20104 static inline uint64_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
20105         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
20106         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
20107         return tag_ptr(ret_conv, true);
20108 }
20109 int64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
20110         LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(arg);
20111         int64_t ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
20112         return ret_conv;
20113 }
20114
20115 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone(uint64_t orig) {
20116         LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(orig);
20117         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
20118         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
20119         return tag_ptr(ret_conv, true);
20120 }
20121
20122 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_ok(uint64_t o) {
20123         LDKErrorMessage o_conv;
20124         o_conv.inner = untag_ptr(o);
20125         o_conv.is_owned = ptr_is_owned(o);
20126         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20127         o_conv = ErrorMessage_clone(&o_conv);
20128         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
20129         *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
20130         return tag_ptr(ret_conv, true);
20131 }
20132
20133 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_err"))) TS_CResult_ErrorMessageDecodeErrorZ_err(uint64_t e) {
20134         LDKDecodeError e_conv;
20135         e_conv.inner = untag_ptr(e);
20136         e_conv.is_owned = ptr_is_owned(e);
20137         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20138         e_conv = DecodeError_clone(&e_conv);
20139         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
20140         *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
20141         return tag_ptr(ret_conv, true);
20142 }
20143
20144 jboolean  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_is_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_is_ok(uint64_t o) {
20145         LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(o);
20146         jboolean ret_conv = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
20147         return ret_conv;
20148 }
20149
20150 void  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_free"))) TS_CResult_ErrorMessageDecodeErrorZ_free(uint64_t _res) {
20151         if (!ptr_is_owned(_res)) return;
20152         void* _res_ptr = untag_ptr(_res);
20153         CHECK_ACCESS(_res_ptr);
20154         LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
20155         FREE(untag_ptr(_res));
20156         CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
20157 }
20158
20159 static inline uint64_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
20160         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
20161         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
20162         return tag_ptr(ret_conv, true);
20163 }
20164 int64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr"))) TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
20165         LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(arg);
20166         int64_t ret_conv = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
20167         return ret_conv;
20168 }
20169
20170 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone"))) TS_CResult_ErrorMessageDecodeErrorZ_clone(uint64_t orig) {
20171         LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(orig);
20172         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
20173         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
20174         return tag_ptr(ret_conv, true);
20175 }
20176
20177 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_ok"))) TS_CResult_WarningMessageDecodeErrorZ_ok(uint64_t o) {
20178         LDKWarningMessage o_conv;
20179         o_conv.inner = untag_ptr(o);
20180         o_conv.is_owned = ptr_is_owned(o);
20181         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20182         o_conv = WarningMessage_clone(&o_conv);
20183         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
20184         *ret_conv = CResult_WarningMessageDecodeErrorZ_ok(o_conv);
20185         return tag_ptr(ret_conv, true);
20186 }
20187
20188 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_err"))) TS_CResult_WarningMessageDecodeErrorZ_err(uint64_t e) {
20189         LDKDecodeError e_conv;
20190         e_conv.inner = untag_ptr(e);
20191         e_conv.is_owned = ptr_is_owned(e);
20192         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20193         e_conv = DecodeError_clone(&e_conv);
20194         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
20195         *ret_conv = CResult_WarningMessageDecodeErrorZ_err(e_conv);
20196         return tag_ptr(ret_conv, true);
20197 }
20198
20199 jboolean  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_is_ok"))) TS_CResult_WarningMessageDecodeErrorZ_is_ok(uint64_t o) {
20200         LDKCResult_WarningMessageDecodeErrorZ* o_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(o);
20201         jboolean ret_conv = CResult_WarningMessageDecodeErrorZ_is_ok(o_conv);
20202         return ret_conv;
20203 }
20204
20205 void  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_free"))) TS_CResult_WarningMessageDecodeErrorZ_free(uint64_t _res) {
20206         if (!ptr_is_owned(_res)) return;
20207         void* _res_ptr = untag_ptr(_res);
20208         CHECK_ACCESS(_res_ptr);
20209         LDKCResult_WarningMessageDecodeErrorZ _res_conv = *(LDKCResult_WarningMessageDecodeErrorZ*)(_res_ptr);
20210         FREE(untag_ptr(_res));
20211         CResult_WarningMessageDecodeErrorZ_free(_res_conv);
20212 }
20213
20214 static inline uint64_t CResult_WarningMessageDecodeErrorZ_clone_ptr(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR arg) {
20215         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
20216         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(arg);
20217         return tag_ptr(ret_conv, true);
20218 }
20219 int64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_clone_ptr"))) TS_CResult_WarningMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
20220         LDKCResult_WarningMessageDecodeErrorZ* arg_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(arg);
20221         int64_t ret_conv = CResult_WarningMessageDecodeErrorZ_clone_ptr(arg_conv);
20222         return ret_conv;
20223 }
20224
20225 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_clone"))) TS_CResult_WarningMessageDecodeErrorZ_clone(uint64_t orig) {
20226         LDKCResult_WarningMessageDecodeErrorZ* orig_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(orig);
20227         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
20228         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(orig_conv);
20229         return tag_ptr(ret_conv, true);
20230 }
20231
20232 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(uint64_t o) {
20233         LDKUnsignedNodeAnnouncement o_conv;
20234         o_conv.inner = untag_ptr(o);
20235         o_conv.is_owned = ptr_is_owned(o);
20236         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20237         o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
20238         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
20239         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
20240         return tag_ptr(ret_conv, true);
20241 }
20242
20243 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(uint64_t e) {
20244         LDKDecodeError e_conv;
20245         e_conv.inner = untag_ptr(e);
20246         e_conv.is_owned = ptr_is_owned(e);
20247         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20248         e_conv = DecodeError_clone(&e_conv);
20249         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
20250         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
20251         return tag_ptr(ret_conv, true);
20252 }
20253
20254 jboolean  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
20255         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(o);
20256         jboolean ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
20257         return ret_conv;
20258 }
20259
20260 void  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(uint64_t _res) {
20261         if (!ptr_is_owned(_res)) return;
20262         void* _res_ptr = untag_ptr(_res);
20263         CHECK_ACCESS(_res_ptr);
20264         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
20265         FREE(untag_ptr(_res));
20266         CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
20267 }
20268
20269 static inline uint64_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
20270         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
20271         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
20272         return tag_ptr(ret_conv, true);
20273 }
20274 int64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
20275         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
20276         int64_t ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
20277         return ret_conv;
20278 }
20279
20280 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(uint64_t orig) {
20281         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
20282         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
20283         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
20284         return tag_ptr(ret_conv, true);
20285 }
20286
20287 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_ok(uint64_t o) {
20288         LDKNodeAnnouncement o_conv;
20289         o_conv.inner = untag_ptr(o);
20290         o_conv.is_owned = ptr_is_owned(o);
20291         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20292         o_conv = NodeAnnouncement_clone(&o_conv);
20293         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
20294         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
20295         return tag_ptr(ret_conv, true);
20296 }
20297
20298 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_err"))) TS_CResult_NodeAnnouncementDecodeErrorZ_err(uint64_t e) {
20299         LDKDecodeError e_conv;
20300         e_conv.inner = untag_ptr(e);
20301         e_conv.is_owned = ptr_is_owned(e);
20302         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20303         e_conv = DecodeError_clone(&e_conv);
20304         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
20305         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
20306         return tag_ptr(ret_conv, true);
20307 }
20308
20309 jboolean  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
20310         LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(o);
20311         jboolean ret_conv = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
20312         return ret_conv;
20313 }
20314
20315 void  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_free"))) TS_CResult_NodeAnnouncementDecodeErrorZ_free(uint64_t _res) {
20316         if (!ptr_is_owned(_res)) return;
20317         void* _res_ptr = untag_ptr(_res);
20318         CHECK_ACCESS(_res_ptr);
20319         LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
20320         FREE(untag_ptr(_res));
20321         CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
20322 }
20323
20324 static inline uint64_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
20325         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
20326         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
20327         return tag_ptr(ret_conv, true);
20328 }
20329 int64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
20330         LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
20331         int64_t ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
20332         return ret_conv;
20333 }
20334
20335 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone(uint64_t orig) {
20336         LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
20337         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
20338         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
20339         return tag_ptr(ret_conv, true);
20340 }
20341
20342 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok(uint64_t o) {
20343         LDKQueryShortChannelIds o_conv;
20344         o_conv.inner = untag_ptr(o);
20345         o_conv.is_owned = ptr_is_owned(o);
20346         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20347         o_conv = QueryShortChannelIds_clone(&o_conv);
20348         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
20349         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
20350         return tag_ptr(ret_conv, true);
20351 }
20352
20353 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_err"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_err(uint64_t e) {
20354         LDKDecodeError e_conv;
20355         e_conv.inner = untag_ptr(e);
20356         e_conv.is_owned = ptr_is_owned(e);
20357         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20358         e_conv = DecodeError_clone(&e_conv);
20359         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
20360         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
20361         return tag_ptr(ret_conv, true);
20362 }
20363
20364 jboolean  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(uint64_t o) {
20365         LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(o);
20366         jboolean ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
20367         return ret_conv;
20368 }
20369
20370 void  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_free"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_free(uint64_t _res) {
20371         if (!ptr_is_owned(_res)) return;
20372         void* _res_ptr = untag_ptr(_res);
20373         CHECK_ACCESS(_res_ptr);
20374         LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
20375         FREE(untag_ptr(_res));
20376         CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
20377 }
20378
20379 static inline uint64_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
20380         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
20381         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
20382         return tag_ptr(ret_conv, true);
20383 }
20384 int64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(uint64_t arg) {
20385         LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(arg);
20386         int64_t ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
20387         return ret_conv;
20388 }
20389
20390 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone(uint64_t orig) {
20391         LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(orig);
20392         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
20393         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
20394         return tag_ptr(ret_conv, true);
20395 }
20396
20397 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(uint64_t o) {
20398         LDKReplyShortChannelIdsEnd o_conv;
20399         o_conv.inner = untag_ptr(o);
20400         o_conv.is_owned = ptr_is_owned(o);
20401         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20402         o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
20403         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
20404         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
20405         return tag_ptr(ret_conv, true);
20406 }
20407
20408 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(uint64_t e) {
20409         LDKDecodeError e_conv;
20410         e_conv.inner = untag_ptr(e);
20411         e_conv.is_owned = ptr_is_owned(e);
20412         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20413         e_conv = DecodeError_clone(&e_conv);
20414         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
20415         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
20416         return tag_ptr(ret_conv, true);
20417 }
20418
20419 jboolean  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(uint64_t o) {
20420         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(o);
20421         jboolean ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
20422         return ret_conv;
20423 }
20424
20425 void  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(uint64_t _res) {
20426         if (!ptr_is_owned(_res)) return;
20427         void* _res_ptr = untag_ptr(_res);
20428         CHECK_ACCESS(_res_ptr);
20429         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
20430         FREE(untag_ptr(_res));
20431         CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
20432 }
20433
20434 static inline uint64_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
20435         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
20436         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
20437         return tag_ptr(ret_conv, true);
20438 }
20439 int64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(uint64_t arg) {
20440         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(arg);
20441         int64_t ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
20442         return ret_conv;
20443 }
20444
20445 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(uint64_t orig) {
20446         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(orig);
20447         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
20448         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
20449         return tag_ptr(ret_conv, true);
20450 }
20451
20452 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_ok(uint64_t o) {
20453         LDKQueryChannelRange o_conv;
20454         o_conv.inner = untag_ptr(o);
20455         o_conv.is_owned = ptr_is_owned(o);
20456         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20457         o_conv = QueryChannelRange_clone(&o_conv);
20458         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
20459         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
20460         return tag_ptr(ret_conv, true);
20461 }
20462
20463 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_err"))) TS_CResult_QueryChannelRangeDecodeErrorZ_err(uint64_t e) {
20464         LDKDecodeError e_conv;
20465         e_conv.inner = untag_ptr(e);
20466         e_conv.is_owned = ptr_is_owned(e);
20467         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20468         e_conv = DecodeError_clone(&e_conv);
20469         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
20470         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
20471         return tag_ptr(ret_conv, true);
20472 }
20473
20474 jboolean  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok(uint64_t o) {
20475         LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(o);
20476         jboolean ret_conv = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
20477         return ret_conv;
20478 }
20479
20480 void  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_free"))) TS_CResult_QueryChannelRangeDecodeErrorZ_free(uint64_t _res) {
20481         if (!ptr_is_owned(_res)) return;
20482         void* _res_ptr = untag_ptr(_res);
20483         CHECK_ACCESS(_res_ptr);
20484         LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
20485         FREE(untag_ptr(_res));
20486         CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
20487 }
20488
20489 static inline uint64_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
20490         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
20491         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
20492         return tag_ptr(ret_conv, true);
20493 }
20494 int64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
20495         LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(arg);
20496         int64_t ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
20497         return ret_conv;
20498 }
20499
20500 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone(uint64_t orig) {
20501         LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(orig);
20502         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
20503         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
20504         return tag_ptr(ret_conv, true);
20505 }
20506
20507 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_ok(uint64_t o) {
20508         LDKReplyChannelRange o_conv;
20509         o_conv.inner = untag_ptr(o);
20510         o_conv.is_owned = ptr_is_owned(o);
20511         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20512         o_conv = ReplyChannelRange_clone(&o_conv);
20513         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
20514         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
20515         return tag_ptr(ret_conv, true);
20516 }
20517
20518 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_err"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_err(uint64_t e) {
20519         LDKDecodeError e_conv;
20520         e_conv.inner = untag_ptr(e);
20521         e_conv.is_owned = ptr_is_owned(e);
20522         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20523         e_conv = DecodeError_clone(&e_conv);
20524         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
20525         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
20526         return tag_ptr(ret_conv, true);
20527 }
20528
20529 jboolean  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok(uint64_t o) {
20530         LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(o);
20531         jboolean ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
20532         return ret_conv;
20533 }
20534
20535 void  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_free"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_free(uint64_t _res) {
20536         if (!ptr_is_owned(_res)) return;
20537         void* _res_ptr = untag_ptr(_res);
20538         CHECK_ACCESS(_res_ptr);
20539         LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
20540         FREE(untag_ptr(_res));
20541         CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
20542 }
20543
20544 static inline uint64_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
20545         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
20546         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
20547         return tag_ptr(ret_conv, true);
20548 }
20549 int64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
20550         LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(arg);
20551         int64_t ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
20552         return ret_conv;
20553 }
20554
20555 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone(uint64_t orig) {
20556         LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(orig);
20557         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
20558         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
20559         return tag_ptr(ret_conv, true);
20560 }
20561
20562 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_ok(uint64_t o) {
20563         LDKGossipTimestampFilter o_conv;
20564         o_conv.inner = untag_ptr(o);
20565         o_conv.is_owned = ptr_is_owned(o);
20566         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20567         o_conv = GossipTimestampFilter_clone(&o_conv);
20568         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
20569         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
20570         return tag_ptr(ret_conv, true);
20571 }
20572
20573 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_err"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_err(uint64_t e) {
20574         LDKDecodeError e_conv;
20575         e_conv.inner = untag_ptr(e);
20576         e_conv.is_owned = ptr_is_owned(e);
20577         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20578         e_conv = DecodeError_clone(&e_conv);
20579         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
20580         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
20581         return tag_ptr(ret_conv, true);
20582 }
20583
20584 jboolean  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok(uint64_t o) {
20585         LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(o);
20586         jboolean ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
20587         return ret_conv;
20588 }
20589
20590 void  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_free"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_free(uint64_t _res) {
20591         if (!ptr_is_owned(_res)) return;
20592         void* _res_ptr = untag_ptr(_res);
20593         CHECK_ACCESS(_res_ptr);
20594         LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
20595         FREE(untag_ptr(_res));
20596         CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
20597 }
20598
20599 static inline uint64_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
20600         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
20601         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
20602         return tag_ptr(ret_conv, true);
20603 }
20604 int64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(uint64_t arg) {
20605         LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(arg);
20606         int64_t ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
20607         return ret_conv;
20608 }
20609
20610 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone(uint64_t orig) {
20611         LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(orig);
20612         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
20613         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
20614         return tag_ptr(ret_conv, true);
20615 }
20616
20617 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_ok"))) TS_CResult_InvoiceSignOrCreationErrorZ_ok(uint64_t o) {
20618         LDKInvoice o_conv;
20619         o_conv.inner = untag_ptr(o);
20620         o_conv.is_owned = ptr_is_owned(o);
20621         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20622         o_conv = Invoice_clone(&o_conv);
20623         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
20624         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_ok(o_conv);
20625         return tag_ptr(ret_conv, true);
20626 }
20627
20628 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_err"))) TS_CResult_InvoiceSignOrCreationErrorZ_err(uint64_t e) {
20629         void* e_ptr = untag_ptr(e);
20630         CHECK_ACCESS(e_ptr);
20631         LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
20632         e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)untag_ptr(e));
20633         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
20634         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
20635         return tag_ptr(ret_conv, true);
20636 }
20637
20638 jboolean  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_is_ok"))) TS_CResult_InvoiceSignOrCreationErrorZ_is_ok(uint64_t o) {
20639         LDKCResult_InvoiceSignOrCreationErrorZ* o_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(o);
20640         jboolean ret_conv = CResult_InvoiceSignOrCreationErrorZ_is_ok(o_conv);
20641         return ret_conv;
20642 }
20643
20644 void  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_free"))) TS_CResult_InvoiceSignOrCreationErrorZ_free(uint64_t _res) {
20645         if (!ptr_is_owned(_res)) return;
20646         void* _res_ptr = untag_ptr(_res);
20647         CHECK_ACCESS(_res_ptr);
20648         LDKCResult_InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_InvoiceSignOrCreationErrorZ*)(_res_ptr);
20649         FREE(untag_ptr(_res));
20650         CResult_InvoiceSignOrCreationErrorZ_free(_res_conv);
20651 }
20652
20653 static inline uint64_t CResult_InvoiceSignOrCreationErrorZ_clone_ptr(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR arg) {
20654         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
20655         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(arg);
20656         return tag_ptr(ret_conv, true);
20657 }
20658 int64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_clone_ptr"))) TS_CResult_InvoiceSignOrCreationErrorZ_clone_ptr(uint64_t arg) {
20659         LDKCResult_InvoiceSignOrCreationErrorZ* arg_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(arg);
20660         int64_t ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone_ptr(arg_conv);
20661         return ret_conv;
20662 }
20663
20664 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_clone"))) TS_CResult_InvoiceSignOrCreationErrorZ_clone(uint64_t orig) {
20665         LDKCResult_InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(orig);
20666         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
20667         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(orig_conv);
20668         return tag_ptr(ret_conv, true);
20669 }
20670
20671 uint64_t  __attribute__((export_name("TS_COption_FilterZ_some"))) TS_COption_FilterZ_some(uint64_t o) {
20672         void* o_ptr = untag_ptr(o);
20673         CHECK_ACCESS(o_ptr);
20674         LDKFilter o_conv = *(LDKFilter*)(o_ptr);
20675         if (o_conv.free == LDKFilter_JCalls_free) {
20676                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20677                 LDKFilter_JCalls_cloned(&o_conv);
20678         }
20679         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
20680         *ret_copy = COption_FilterZ_some(o_conv);
20681         uint64_t ret_ref = tag_ptr(ret_copy, true);
20682         return ret_ref;
20683 }
20684
20685 uint64_t  __attribute__((export_name("TS_COption_FilterZ_none"))) TS_COption_FilterZ_none() {
20686         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
20687         *ret_copy = COption_FilterZ_none();
20688         uint64_t ret_ref = tag_ptr(ret_copy, true);
20689         return ret_ref;
20690 }
20691
20692 void  __attribute__((export_name("TS_COption_FilterZ_free"))) TS_COption_FilterZ_free(uint64_t _res) {
20693         if (!ptr_is_owned(_res)) return;
20694         void* _res_ptr = untag_ptr(_res);
20695         CHECK_ACCESS(_res_ptr);
20696         LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
20697         FREE(untag_ptr(_res));
20698         COption_FilterZ_free(_res_conv);
20699 }
20700
20701 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_ok"))) TS_CResult_LockedChannelMonitorNoneZ_ok(uint64_t o) {
20702         LDKLockedChannelMonitor o_conv;
20703         o_conv.inner = untag_ptr(o);
20704         o_conv.is_owned = ptr_is_owned(o);
20705         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20706         // WARNING: we need a move here but no clone is available for LDKLockedChannelMonitor
20707         
20708         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
20709         *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
20710         return tag_ptr(ret_conv, true);
20711 }
20712
20713 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_err"))) TS_CResult_LockedChannelMonitorNoneZ_err() {
20714         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
20715         *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
20716         return tag_ptr(ret_conv, true);
20717 }
20718
20719 jboolean  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_is_ok"))) TS_CResult_LockedChannelMonitorNoneZ_is_ok(uint64_t o) {
20720         LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(o);
20721         jboolean ret_conv = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
20722         return ret_conv;
20723 }
20724
20725 void  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_free"))) TS_CResult_LockedChannelMonitorNoneZ_free(uint64_t _res) {
20726         if (!ptr_is_owned(_res)) return;
20727         void* _res_ptr = untag_ptr(_res);
20728         CHECK_ACCESS(_res_ptr);
20729         LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
20730         FREE(untag_ptr(_res));
20731         CResult_LockedChannelMonitorNoneZ_free(_res_conv);
20732 }
20733
20734 void  __attribute__((export_name("TS_CVec_OutPointZ_free"))) TS_CVec_OutPointZ_free(uint64_tArray _res) {
20735         LDKCVec_OutPointZ _res_constr;
20736         _res_constr.datalen = _res->arr_len;
20737         if (_res_constr.datalen > 0)
20738                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
20739         else
20740                 _res_constr.data = NULL;
20741         uint64_t* _res_vals = _res->elems;
20742         for (size_t k = 0; k < _res_constr.datalen; k++) {
20743                 uint64_t _res_conv_10 = _res_vals[k];
20744                 LDKOutPoint _res_conv_10_conv;
20745                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
20746                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
20747                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
20748                 _res_constr.data[k] = _res_conv_10_conv;
20749         }
20750         FREE(_res);
20751         CVec_OutPointZ_free(_res_constr);
20752 }
20753
20754 void  __attribute__((export_name("TS_PaymentPurpose_free"))) TS_PaymentPurpose_free(uint64_t this_ptr) {
20755         if (!ptr_is_owned(this_ptr)) return;
20756         void* this_ptr_ptr = untag_ptr(this_ptr);
20757         CHECK_ACCESS(this_ptr_ptr);
20758         LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
20759         FREE(untag_ptr(this_ptr));
20760         PaymentPurpose_free(this_ptr_conv);
20761 }
20762
20763 static inline uint64_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
20764         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
20765         *ret_copy = PaymentPurpose_clone(arg);
20766         uint64_t ret_ref = tag_ptr(ret_copy, true);
20767         return ret_ref;
20768 }
20769 int64_t  __attribute__((export_name("TS_PaymentPurpose_clone_ptr"))) TS_PaymentPurpose_clone_ptr(uint64_t arg) {
20770         LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)untag_ptr(arg);
20771         int64_t ret_conv = PaymentPurpose_clone_ptr(arg_conv);
20772         return ret_conv;
20773 }
20774
20775 uint64_t  __attribute__((export_name("TS_PaymentPurpose_clone"))) TS_PaymentPurpose_clone(uint64_t orig) {
20776         LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)untag_ptr(orig);
20777         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
20778         *ret_copy = PaymentPurpose_clone(orig_conv);
20779         uint64_t ret_ref = tag_ptr(ret_copy, true);
20780         return ret_ref;
20781 }
20782
20783 uint64_t  __attribute__((export_name("TS_PaymentPurpose_invoice_payment"))) TS_PaymentPurpose_invoice_payment(int8_tArray payment_preimage, int8_tArray payment_secret) {
20784         LDKThirtyTwoBytes payment_preimage_ref;
20785         CHECK(payment_preimage->arr_len == 32);
20786         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
20787         LDKThirtyTwoBytes payment_secret_ref;
20788         CHECK(payment_secret->arr_len == 32);
20789         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
20790         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
20791         *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref);
20792         uint64_t ret_ref = tag_ptr(ret_copy, true);
20793         return ret_ref;
20794 }
20795
20796 uint64_t  __attribute__((export_name("TS_PaymentPurpose_spontaneous_payment"))) TS_PaymentPurpose_spontaneous_payment(int8_tArray a) {
20797         LDKThirtyTwoBytes a_ref;
20798         CHECK(a->arr_len == 32);
20799         memcpy(a_ref.data, a->elems, 32); FREE(a);
20800         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
20801         *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
20802         uint64_t ret_ref = tag_ptr(ret_copy, true);
20803         return ret_ref;
20804 }
20805
20806 int8_tArray  __attribute__((export_name("TS_PaymentPurpose_write"))) TS_PaymentPurpose_write(uint64_t obj) {
20807         LDKPaymentPurpose* obj_conv = (LDKPaymentPurpose*)untag_ptr(obj);
20808         LDKCVec_u8Z ret_var = PaymentPurpose_write(obj_conv);
20809         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
20810         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
20811         CVec_u8Z_free(ret_var);
20812         return ret_arr;
20813 }
20814
20815 uint64_t  __attribute__((export_name("TS_PaymentPurpose_read"))) TS_PaymentPurpose_read(int8_tArray ser) {
20816         LDKu8slice ser_ref;
20817         ser_ref.datalen = ser->arr_len;
20818         ser_ref.data = ser->elems;
20819         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
20820         *ret_conv = PaymentPurpose_read(ser_ref);
20821         FREE(ser);
20822         return tag_ptr(ret_conv, true);
20823 }
20824
20825 void  __attribute__((export_name("TS_ClosureReason_free"))) TS_ClosureReason_free(uint64_t this_ptr) {
20826         if (!ptr_is_owned(this_ptr)) return;
20827         void* this_ptr_ptr = untag_ptr(this_ptr);
20828         CHECK_ACCESS(this_ptr_ptr);
20829         LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
20830         FREE(untag_ptr(this_ptr));
20831         ClosureReason_free(this_ptr_conv);
20832 }
20833
20834 static inline uint64_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
20835         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20836         *ret_copy = ClosureReason_clone(arg);
20837         uint64_t ret_ref = tag_ptr(ret_copy, true);
20838         return ret_ref;
20839 }
20840 int64_t  __attribute__((export_name("TS_ClosureReason_clone_ptr"))) TS_ClosureReason_clone_ptr(uint64_t arg) {
20841         LDKClosureReason* arg_conv = (LDKClosureReason*)untag_ptr(arg);
20842         int64_t ret_conv = ClosureReason_clone_ptr(arg_conv);
20843         return ret_conv;
20844 }
20845
20846 uint64_t  __attribute__((export_name("TS_ClosureReason_clone"))) TS_ClosureReason_clone(uint64_t orig) {
20847         LDKClosureReason* orig_conv = (LDKClosureReason*)untag_ptr(orig);
20848         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20849         *ret_copy = ClosureReason_clone(orig_conv);
20850         uint64_t ret_ref = tag_ptr(ret_copy, true);
20851         return ret_ref;
20852 }
20853
20854 uint64_t  __attribute__((export_name("TS_ClosureReason_counterparty_force_closed"))) TS_ClosureReason_counterparty_force_closed(jstring peer_msg) {
20855         LDKStr peer_msg_conv = str_ref_to_owned_c(peer_msg);
20856         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20857         *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
20858         uint64_t ret_ref = tag_ptr(ret_copy, true);
20859         return ret_ref;
20860 }
20861
20862 uint64_t  __attribute__((export_name("TS_ClosureReason_holder_force_closed"))) TS_ClosureReason_holder_force_closed() {
20863         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20864         *ret_copy = ClosureReason_holder_force_closed();
20865         uint64_t ret_ref = tag_ptr(ret_copy, true);
20866         return ret_ref;
20867 }
20868
20869 uint64_t  __attribute__((export_name("TS_ClosureReason_cooperative_closure"))) TS_ClosureReason_cooperative_closure() {
20870         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20871         *ret_copy = ClosureReason_cooperative_closure();
20872         uint64_t ret_ref = tag_ptr(ret_copy, true);
20873         return ret_ref;
20874 }
20875
20876 uint64_t  __attribute__((export_name("TS_ClosureReason_commitment_tx_confirmed"))) TS_ClosureReason_commitment_tx_confirmed() {
20877         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20878         *ret_copy = ClosureReason_commitment_tx_confirmed();
20879         uint64_t ret_ref = tag_ptr(ret_copy, true);
20880         return ret_ref;
20881 }
20882
20883 uint64_t  __attribute__((export_name("TS_ClosureReason_funding_timed_out"))) TS_ClosureReason_funding_timed_out() {
20884         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20885         *ret_copy = ClosureReason_funding_timed_out();
20886         uint64_t ret_ref = tag_ptr(ret_copy, true);
20887         return ret_ref;
20888 }
20889
20890 uint64_t  __attribute__((export_name("TS_ClosureReason_processing_error"))) TS_ClosureReason_processing_error(jstring err) {
20891         LDKStr err_conv = str_ref_to_owned_c(err);
20892         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20893         *ret_copy = ClosureReason_processing_error(err_conv);
20894         uint64_t ret_ref = tag_ptr(ret_copy, true);
20895         return ret_ref;
20896 }
20897
20898 uint64_t  __attribute__((export_name("TS_ClosureReason_disconnected_peer"))) TS_ClosureReason_disconnected_peer() {
20899         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20900         *ret_copy = ClosureReason_disconnected_peer();
20901         uint64_t ret_ref = tag_ptr(ret_copy, true);
20902         return ret_ref;
20903 }
20904
20905 uint64_t  __attribute__((export_name("TS_ClosureReason_outdated_channel_manager"))) TS_ClosureReason_outdated_channel_manager() {
20906         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20907         *ret_copy = ClosureReason_outdated_channel_manager();
20908         uint64_t ret_ref = tag_ptr(ret_copy, true);
20909         return ret_ref;
20910 }
20911
20912 int8_tArray  __attribute__((export_name("TS_ClosureReason_write"))) TS_ClosureReason_write(uint64_t obj) {
20913         LDKClosureReason* obj_conv = (LDKClosureReason*)untag_ptr(obj);
20914         LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
20915         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
20916         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
20917         CVec_u8Z_free(ret_var);
20918         return ret_arr;
20919 }
20920
20921 uint64_t  __attribute__((export_name("TS_ClosureReason_read"))) TS_ClosureReason_read(int8_tArray ser) {
20922         LDKu8slice ser_ref;
20923         ser_ref.datalen = ser->arr_len;
20924         ser_ref.data = ser->elems;
20925         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
20926         *ret_conv = ClosureReason_read(ser_ref);
20927         FREE(ser);
20928         return tag_ptr(ret_conv, true);
20929 }
20930
20931 void  __attribute__((export_name("TS_HTLCDestination_free"))) TS_HTLCDestination_free(uint64_t this_ptr) {
20932         if (!ptr_is_owned(this_ptr)) return;
20933         void* this_ptr_ptr = untag_ptr(this_ptr);
20934         CHECK_ACCESS(this_ptr_ptr);
20935         LDKHTLCDestination this_ptr_conv = *(LDKHTLCDestination*)(this_ptr_ptr);
20936         FREE(untag_ptr(this_ptr));
20937         HTLCDestination_free(this_ptr_conv);
20938 }
20939
20940 static inline uint64_t HTLCDestination_clone_ptr(LDKHTLCDestination *NONNULL_PTR arg) {
20941         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
20942         *ret_copy = HTLCDestination_clone(arg);
20943         uint64_t ret_ref = tag_ptr(ret_copy, true);
20944         return ret_ref;
20945 }
20946 int64_t  __attribute__((export_name("TS_HTLCDestination_clone_ptr"))) TS_HTLCDestination_clone_ptr(uint64_t arg) {
20947         LDKHTLCDestination* arg_conv = (LDKHTLCDestination*)untag_ptr(arg);
20948         int64_t ret_conv = HTLCDestination_clone_ptr(arg_conv);
20949         return ret_conv;
20950 }
20951
20952 uint64_t  __attribute__((export_name("TS_HTLCDestination_clone"))) TS_HTLCDestination_clone(uint64_t orig) {
20953         LDKHTLCDestination* orig_conv = (LDKHTLCDestination*)untag_ptr(orig);
20954         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
20955         *ret_copy = HTLCDestination_clone(orig_conv);
20956         uint64_t ret_ref = tag_ptr(ret_copy, true);
20957         return ret_ref;
20958 }
20959
20960 uint64_t  __attribute__((export_name("TS_HTLCDestination_next_hop_channel"))) TS_HTLCDestination_next_hop_channel(int8_tArray node_id, int8_tArray channel_id) {
20961         LDKPublicKey node_id_ref;
20962         CHECK(node_id->arr_len == 33);
20963         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20964         LDKThirtyTwoBytes channel_id_ref;
20965         CHECK(channel_id->arr_len == 32);
20966         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
20967         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
20968         *ret_copy = HTLCDestination_next_hop_channel(node_id_ref, channel_id_ref);
20969         uint64_t ret_ref = tag_ptr(ret_copy, true);
20970         return ret_ref;
20971 }
20972
20973 uint64_t  __attribute__((export_name("TS_HTLCDestination_unknown_next_hop"))) TS_HTLCDestination_unknown_next_hop(int64_t requested_forward_scid) {
20974         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
20975         *ret_copy = HTLCDestination_unknown_next_hop(requested_forward_scid);
20976         uint64_t ret_ref = tag_ptr(ret_copy, true);
20977         return ret_ref;
20978 }
20979
20980 uint64_t  __attribute__((export_name("TS_HTLCDestination_failed_payment"))) TS_HTLCDestination_failed_payment(int8_tArray payment_hash) {
20981         LDKThirtyTwoBytes payment_hash_ref;
20982         CHECK(payment_hash->arr_len == 32);
20983         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
20984         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
20985         *ret_copy = HTLCDestination_failed_payment(payment_hash_ref);
20986         uint64_t ret_ref = tag_ptr(ret_copy, true);
20987         return ret_ref;
20988 }
20989
20990 int8_tArray  __attribute__((export_name("TS_HTLCDestination_write"))) TS_HTLCDestination_write(uint64_t obj) {
20991         LDKHTLCDestination* obj_conv = (LDKHTLCDestination*)untag_ptr(obj);
20992         LDKCVec_u8Z ret_var = HTLCDestination_write(obj_conv);
20993         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
20994         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
20995         CVec_u8Z_free(ret_var);
20996         return ret_arr;
20997 }
20998
20999 uint64_t  __attribute__((export_name("TS_HTLCDestination_read"))) TS_HTLCDestination_read(int8_tArray ser) {
21000         LDKu8slice ser_ref;
21001         ser_ref.datalen = ser->arr_len;
21002         ser_ref.data = ser->elems;
21003         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
21004         *ret_conv = HTLCDestination_read(ser_ref);
21005         FREE(ser);
21006         return tag_ptr(ret_conv, true);
21007 }
21008
21009 void  __attribute__((export_name("TS_Event_free"))) TS_Event_free(uint64_t this_ptr) {
21010         if (!ptr_is_owned(this_ptr)) return;
21011         void* this_ptr_ptr = untag_ptr(this_ptr);
21012         CHECK_ACCESS(this_ptr_ptr);
21013         LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
21014         FREE(untag_ptr(this_ptr));
21015         Event_free(this_ptr_conv);
21016 }
21017
21018 static inline uint64_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
21019         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21020         *ret_copy = Event_clone(arg);
21021         uint64_t ret_ref = tag_ptr(ret_copy, true);
21022         return ret_ref;
21023 }
21024 int64_t  __attribute__((export_name("TS_Event_clone_ptr"))) TS_Event_clone_ptr(uint64_t arg) {
21025         LDKEvent* arg_conv = (LDKEvent*)untag_ptr(arg);
21026         int64_t ret_conv = Event_clone_ptr(arg_conv);
21027         return ret_conv;
21028 }
21029
21030 uint64_t  __attribute__((export_name("TS_Event_clone"))) TS_Event_clone(uint64_t orig) {
21031         LDKEvent* orig_conv = (LDKEvent*)untag_ptr(orig);
21032         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21033         *ret_copy = Event_clone(orig_conv);
21034         uint64_t ret_ref = tag_ptr(ret_copy, true);
21035         return ret_ref;
21036 }
21037
21038 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) {
21039         LDKThirtyTwoBytes temporary_channel_id_ref;
21040         CHECK(temporary_channel_id->arr_len == 32);
21041         memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
21042         LDKPublicKey counterparty_node_id_ref;
21043         CHECK(counterparty_node_id->arr_len == 33);
21044         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
21045         LDKCVec_u8Z output_script_ref;
21046         output_script_ref.datalen = output_script->arr_len;
21047         output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
21048         memcpy(output_script_ref.data, output_script->elems, output_script_ref.datalen); FREE(output_script);
21049         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21050         *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, counterparty_node_id_ref, channel_value_satoshis, output_script_ref, user_channel_id);
21051         uint64_t ret_ref = tag_ptr(ret_copy, true);
21052         return ret_ref;
21053 }
21054
21055 uint64_t  __attribute__((export_name("TS_Event_payment_received"))) TS_Event_payment_received(int8_tArray payment_hash, int64_t amount_msat, uint64_t purpose) {
21056         LDKThirtyTwoBytes payment_hash_ref;
21057         CHECK(payment_hash->arr_len == 32);
21058         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
21059         void* purpose_ptr = untag_ptr(purpose);
21060         CHECK_ACCESS(purpose_ptr);
21061         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
21062         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
21063         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21064         *ret_copy = Event_payment_received(payment_hash_ref, amount_msat, purpose_conv);
21065         uint64_t ret_ref = tag_ptr(ret_copy, true);
21066         return ret_ref;
21067 }
21068
21069 uint64_t  __attribute__((export_name("TS_Event_payment_claimed"))) TS_Event_payment_claimed(int8_tArray payment_hash, int64_t amount_msat, uint64_t purpose) {
21070         LDKThirtyTwoBytes payment_hash_ref;
21071         CHECK(payment_hash->arr_len == 32);
21072         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
21073         void* purpose_ptr = untag_ptr(purpose);
21074         CHECK_ACCESS(purpose_ptr);
21075         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
21076         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
21077         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21078         *ret_copy = Event_payment_claimed(payment_hash_ref, amount_msat, purpose_conv);
21079         uint64_t ret_ref = tag_ptr(ret_copy, true);
21080         return ret_ref;
21081 }
21082
21083 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) {
21084         LDKThirtyTwoBytes payment_id_ref;
21085         CHECK(payment_id->arr_len == 32);
21086         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
21087         LDKThirtyTwoBytes payment_preimage_ref;
21088         CHECK(payment_preimage->arr_len == 32);
21089         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
21090         LDKThirtyTwoBytes payment_hash_ref;
21091         CHECK(payment_hash->arr_len == 32);
21092         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
21093         void* fee_paid_msat_ptr = untag_ptr(fee_paid_msat);
21094         CHECK_ACCESS(fee_paid_msat_ptr);
21095         LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
21096         fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_paid_msat));
21097         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21098         *ret_copy = Event_payment_sent(payment_id_ref, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
21099         uint64_t ret_ref = tag_ptr(ret_copy, true);
21100         return ret_ref;
21101 }
21102
21103 uint64_t  __attribute__((export_name("TS_Event_payment_failed"))) TS_Event_payment_failed(int8_tArray payment_id, int8_tArray payment_hash) {
21104         LDKThirtyTwoBytes payment_id_ref;
21105         CHECK(payment_id->arr_len == 32);
21106         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
21107         LDKThirtyTwoBytes payment_hash_ref;
21108         CHECK(payment_hash->arr_len == 32);
21109         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
21110         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21111         *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref);
21112         uint64_t ret_ref = tag_ptr(ret_copy, true);
21113         return ret_ref;
21114 }
21115
21116 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) {
21117         LDKThirtyTwoBytes payment_id_ref;
21118         CHECK(payment_id->arr_len == 32);
21119         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
21120         LDKThirtyTwoBytes payment_hash_ref;
21121         CHECK(payment_hash->arr_len == 32);
21122         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
21123         LDKCVec_RouteHopZ path_constr;
21124         path_constr.datalen = path->arr_len;
21125         if (path_constr.datalen > 0)
21126                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
21127         else
21128                 path_constr.data = NULL;
21129         uint64_t* path_vals = path->elems;
21130         for (size_t k = 0; k < path_constr.datalen; k++) {
21131                 uint64_t path_conv_10 = path_vals[k];
21132                 LDKRouteHop path_conv_10_conv;
21133                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
21134                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
21135                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
21136                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
21137                 path_constr.data[k] = path_conv_10_conv;
21138         }
21139         FREE(path);
21140         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21141         *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_ref, path_constr);
21142         uint64_t ret_ref = tag_ptr(ret_copy, true);
21143         return ret_ref;
21144 }
21145
21146 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) {
21147         LDKThirtyTwoBytes payment_id_ref;
21148         CHECK(payment_id->arr_len == 32);
21149         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
21150         LDKThirtyTwoBytes payment_hash_ref;
21151         CHECK(payment_hash->arr_len == 32);
21152         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
21153         void* network_update_ptr = untag_ptr(network_update);
21154         CHECK_ACCESS(network_update_ptr);
21155         LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
21156         network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(network_update));
21157         LDKCVec_RouteHopZ path_constr;
21158         path_constr.datalen = path->arr_len;
21159         if (path_constr.datalen > 0)
21160                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
21161         else
21162                 path_constr.data = NULL;
21163         uint64_t* path_vals = path->elems;
21164         for (size_t k = 0; k < path_constr.datalen; k++) {
21165                 uint64_t path_conv_10 = path_vals[k];
21166                 LDKRouteHop path_conv_10_conv;
21167                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
21168                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
21169                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
21170                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
21171                 path_constr.data[k] = path_conv_10_conv;
21172         }
21173         FREE(path);
21174         void* short_channel_id_ptr = untag_ptr(short_channel_id);
21175         CHECK_ACCESS(short_channel_id_ptr);
21176         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
21177         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
21178         LDKRouteParameters retry_conv;
21179         retry_conv.inner = untag_ptr(retry);
21180         retry_conv.is_owned = ptr_is_owned(retry);
21181         CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_conv);
21182         retry_conv = RouteParameters_clone(&retry_conv);
21183         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21184         *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);
21185         uint64_t ret_ref = tag_ptr(ret_copy, true);
21186         return ret_ref;
21187 }
21188
21189 uint64_t  __attribute__((export_name("TS_Event_probe_successful"))) TS_Event_probe_successful(int8_tArray payment_id, int8_tArray payment_hash, uint64_tArray path) {
21190         LDKThirtyTwoBytes payment_id_ref;
21191         CHECK(payment_id->arr_len == 32);
21192         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
21193         LDKThirtyTwoBytes payment_hash_ref;
21194         CHECK(payment_hash->arr_len == 32);
21195         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
21196         LDKCVec_RouteHopZ path_constr;
21197         path_constr.datalen = path->arr_len;
21198         if (path_constr.datalen > 0)
21199                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
21200         else
21201                 path_constr.data = NULL;
21202         uint64_t* path_vals = path->elems;
21203         for (size_t k = 0; k < path_constr.datalen; k++) {
21204                 uint64_t path_conv_10 = path_vals[k];
21205                 LDKRouteHop path_conv_10_conv;
21206                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
21207                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
21208                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
21209                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
21210                 path_constr.data[k] = path_conv_10_conv;
21211         }
21212         FREE(path);
21213         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21214         *ret_copy = Event_probe_successful(payment_id_ref, payment_hash_ref, path_constr);
21215         uint64_t ret_ref = tag_ptr(ret_copy, true);
21216         return ret_ref;
21217 }
21218
21219 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) {
21220         LDKThirtyTwoBytes payment_id_ref;
21221         CHECK(payment_id->arr_len == 32);
21222         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
21223         LDKThirtyTwoBytes payment_hash_ref;
21224         CHECK(payment_hash->arr_len == 32);
21225         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
21226         LDKCVec_RouteHopZ path_constr;
21227         path_constr.datalen = path->arr_len;
21228         if (path_constr.datalen > 0)
21229                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
21230         else
21231                 path_constr.data = NULL;
21232         uint64_t* path_vals = path->elems;
21233         for (size_t k = 0; k < path_constr.datalen; k++) {
21234                 uint64_t path_conv_10 = path_vals[k];
21235                 LDKRouteHop path_conv_10_conv;
21236                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
21237                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
21238                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
21239                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
21240                 path_constr.data[k] = path_conv_10_conv;
21241         }
21242         FREE(path);
21243         void* short_channel_id_ptr = untag_ptr(short_channel_id);
21244         CHECK_ACCESS(short_channel_id_ptr);
21245         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
21246         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
21247         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21248         *ret_copy = Event_probe_failed(payment_id_ref, payment_hash_ref, path_constr, short_channel_id_conv);
21249         uint64_t ret_ref = tag_ptr(ret_copy, true);
21250         return ret_ref;
21251 }
21252
21253 uint64_t  __attribute__((export_name("TS_Event_pending_htlcs_forwardable"))) TS_Event_pending_htlcs_forwardable(int64_t time_forwardable) {
21254         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21255         *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
21256         uint64_t ret_ref = tag_ptr(ret_copy, true);
21257         return ret_ref;
21258 }
21259
21260 uint64_t  __attribute__((export_name("TS_Event_spendable_outputs"))) TS_Event_spendable_outputs(uint64_tArray outputs) {
21261         LDKCVec_SpendableOutputDescriptorZ outputs_constr;
21262         outputs_constr.datalen = outputs->arr_len;
21263         if (outputs_constr.datalen > 0)
21264                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
21265         else
21266                 outputs_constr.data = NULL;
21267         uint64_t* outputs_vals = outputs->elems;
21268         for (size_t b = 0; b < outputs_constr.datalen; b++) {
21269                 uint64_t outputs_conv_27 = outputs_vals[b];
21270                 void* outputs_conv_27_ptr = untag_ptr(outputs_conv_27);
21271                 CHECK_ACCESS(outputs_conv_27_ptr);
21272                 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
21273                 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(outputs_conv_27));
21274                 outputs_constr.data[b] = outputs_conv_27_conv;
21275         }
21276         FREE(outputs);
21277         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21278         *ret_copy = Event_spendable_outputs(outputs_constr);
21279         uint64_t ret_ref = tag_ptr(ret_copy, true);
21280         return ret_ref;
21281 }
21282
21283 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) {
21284         LDKThirtyTwoBytes prev_channel_id_ref;
21285         CHECK(prev_channel_id->arr_len == 32);
21286         memcpy(prev_channel_id_ref.data, prev_channel_id->elems, 32); FREE(prev_channel_id);
21287         LDKThirtyTwoBytes next_channel_id_ref;
21288         CHECK(next_channel_id->arr_len == 32);
21289         memcpy(next_channel_id_ref.data, next_channel_id->elems, 32); FREE(next_channel_id);
21290         void* fee_earned_msat_ptr = untag_ptr(fee_earned_msat);
21291         CHECK_ACCESS(fee_earned_msat_ptr);
21292         LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
21293         fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_earned_msat));
21294         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21295         *ret_copy = Event_payment_forwarded(prev_channel_id_ref, next_channel_id_ref, fee_earned_msat_conv, claim_from_onchain_tx);
21296         uint64_t ret_ref = tag_ptr(ret_copy, true);
21297         return ret_ref;
21298 }
21299
21300 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) {
21301         LDKThirtyTwoBytes channel_id_ref;
21302         CHECK(channel_id->arr_len == 32);
21303         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
21304         void* reason_ptr = untag_ptr(reason);
21305         CHECK_ACCESS(reason_ptr);
21306         LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
21307         reason_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(reason));
21308         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21309         *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id, reason_conv);
21310         uint64_t ret_ref = tag_ptr(ret_copy, true);
21311         return ret_ref;
21312 }
21313
21314 uint64_t  __attribute__((export_name("TS_Event_discard_funding"))) TS_Event_discard_funding(int8_tArray channel_id, int8_tArray transaction) {
21315         LDKThirtyTwoBytes channel_id_ref;
21316         CHECK(channel_id->arr_len == 32);
21317         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
21318         LDKTransaction transaction_ref;
21319         transaction_ref.datalen = transaction->arr_len;
21320         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
21321         memcpy(transaction_ref.data, transaction->elems, transaction_ref.datalen); FREE(transaction);
21322         transaction_ref.data_is_owned = true;
21323         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21324         *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
21325         uint64_t ret_ref = tag_ptr(ret_copy, true);
21326         return ret_ref;
21327 }
21328
21329 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) {
21330         LDKThirtyTwoBytes temporary_channel_id_ref;
21331         CHECK(temporary_channel_id->arr_len == 32);
21332         memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
21333         LDKPublicKey counterparty_node_id_ref;
21334         CHECK(counterparty_node_id->arr_len == 33);
21335         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
21336         LDKChannelTypeFeatures channel_type_conv;
21337         channel_type_conv.inner = untag_ptr(channel_type);
21338         channel_type_conv.is_owned = ptr_is_owned(channel_type);
21339         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
21340         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
21341         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21342         *ret_copy = Event_open_channel_request(temporary_channel_id_ref, counterparty_node_id_ref, funding_satoshis, push_msat, channel_type_conv);
21343         uint64_t ret_ref = tag_ptr(ret_copy, true);
21344         return ret_ref;
21345 }
21346
21347 uint64_t  __attribute__((export_name("TS_Event_htlchandling_failed"))) TS_Event_htlchandling_failed(int8_tArray prev_channel_id, uint64_t failed_next_destination) {
21348         LDKThirtyTwoBytes prev_channel_id_ref;
21349         CHECK(prev_channel_id->arr_len == 32);
21350         memcpy(prev_channel_id_ref.data, prev_channel_id->elems, 32); FREE(prev_channel_id);
21351         void* failed_next_destination_ptr = untag_ptr(failed_next_destination);
21352         CHECK_ACCESS(failed_next_destination_ptr);
21353         LDKHTLCDestination failed_next_destination_conv = *(LDKHTLCDestination*)(failed_next_destination_ptr);
21354         failed_next_destination_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(failed_next_destination));
21355         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21356         *ret_copy = Event_htlchandling_failed(prev_channel_id_ref, failed_next_destination_conv);
21357         uint64_t ret_ref = tag_ptr(ret_copy, true);
21358         return ret_ref;
21359 }
21360
21361 int8_tArray  __attribute__((export_name("TS_Event_write"))) TS_Event_write(uint64_t obj) {
21362         LDKEvent* obj_conv = (LDKEvent*)untag_ptr(obj);
21363         LDKCVec_u8Z ret_var = Event_write(obj_conv);
21364         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
21365         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
21366         CVec_u8Z_free(ret_var);
21367         return ret_arr;
21368 }
21369
21370 uint64_t  __attribute__((export_name("TS_Event_read"))) TS_Event_read(int8_tArray ser) {
21371         LDKu8slice ser_ref;
21372         ser_ref.datalen = ser->arr_len;
21373         ser_ref.data = ser->elems;
21374         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
21375         *ret_conv = Event_read(ser_ref);
21376         FREE(ser);
21377         return tag_ptr(ret_conv, true);
21378 }
21379
21380 void  __attribute__((export_name("TS_MessageSendEvent_free"))) TS_MessageSendEvent_free(uint64_t this_ptr) {
21381         if (!ptr_is_owned(this_ptr)) return;
21382         void* this_ptr_ptr = untag_ptr(this_ptr);
21383         CHECK_ACCESS(this_ptr_ptr);
21384         LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
21385         FREE(untag_ptr(this_ptr));
21386         MessageSendEvent_free(this_ptr_conv);
21387 }
21388
21389 static inline uint64_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
21390         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21391         *ret_copy = MessageSendEvent_clone(arg);
21392         uint64_t ret_ref = tag_ptr(ret_copy, true);
21393         return ret_ref;
21394 }
21395 int64_t  __attribute__((export_name("TS_MessageSendEvent_clone_ptr"))) TS_MessageSendEvent_clone_ptr(uint64_t arg) {
21396         LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)untag_ptr(arg);
21397         int64_t ret_conv = MessageSendEvent_clone_ptr(arg_conv);
21398         return ret_conv;
21399 }
21400
21401 uint64_t  __attribute__((export_name("TS_MessageSendEvent_clone"))) TS_MessageSendEvent_clone(uint64_t orig) {
21402         LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)untag_ptr(orig);
21403         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21404         *ret_copy = MessageSendEvent_clone(orig_conv);
21405         uint64_t ret_ref = tag_ptr(ret_copy, true);
21406         return ret_ref;
21407 }
21408
21409 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_accept_channel"))) TS_MessageSendEvent_send_accept_channel(int8_tArray node_id, uint64_t msg) {
21410         LDKPublicKey node_id_ref;
21411         CHECK(node_id->arr_len == 33);
21412         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21413         LDKAcceptChannel msg_conv;
21414         msg_conv.inner = untag_ptr(msg);
21415         msg_conv.is_owned = ptr_is_owned(msg);
21416         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21417         msg_conv = AcceptChannel_clone(&msg_conv);
21418         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21419         *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
21420         uint64_t ret_ref = tag_ptr(ret_copy, true);
21421         return ret_ref;
21422 }
21423
21424 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_open_channel"))) TS_MessageSendEvent_send_open_channel(int8_tArray node_id, uint64_t msg) {
21425         LDKPublicKey node_id_ref;
21426         CHECK(node_id->arr_len == 33);
21427         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21428         LDKOpenChannel msg_conv;
21429         msg_conv.inner = untag_ptr(msg);
21430         msg_conv.is_owned = ptr_is_owned(msg);
21431         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21432         msg_conv = OpenChannel_clone(&msg_conv);
21433         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21434         *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
21435         uint64_t ret_ref = tag_ptr(ret_copy, true);
21436         return ret_ref;
21437 }
21438
21439 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_funding_created"))) TS_MessageSendEvent_send_funding_created(int8_tArray node_id, uint64_t msg) {
21440         LDKPublicKey node_id_ref;
21441         CHECK(node_id->arr_len == 33);
21442         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21443         LDKFundingCreated msg_conv;
21444         msg_conv.inner = untag_ptr(msg);
21445         msg_conv.is_owned = ptr_is_owned(msg);
21446         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21447         msg_conv = FundingCreated_clone(&msg_conv);
21448         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21449         *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
21450         uint64_t ret_ref = tag_ptr(ret_copy, true);
21451         return ret_ref;
21452 }
21453
21454 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_funding_signed"))) TS_MessageSendEvent_send_funding_signed(int8_tArray node_id, uint64_t msg) {
21455         LDKPublicKey node_id_ref;
21456         CHECK(node_id->arr_len == 33);
21457         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21458         LDKFundingSigned msg_conv;
21459         msg_conv.inner = untag_ptr(msg);
21460         msg_conv.is_owned = ptr_is_owned(msg);
21461         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21462         msg_conv = FundingSigned_clone(&msg_conv);
21463         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21464         *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
21465         uint64_t ret_ref = tag_ptr(ret_copy, true);
21466         return ret_ref;
21467 }
21468
21469 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_ready"))) TS_MessageSendEvent_send_channel_ready(int8_tArray node_id, uint64_t msg) {
21470         LDKPublicKey node_id_ref;
21471         CHECK(node_id->arr_len == 33);
21472         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21473         LDKChannelReady msg_conv;
21474         msg_conv.inner = untag_ptr(msg);
21475         msg_conv.is_owned = ptr_is_owned(msg);
21476         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21477         msg_conv = ChannelReady_clone(&msg_conv);
21478         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21479         *ret_copy = MessageSendEvent_send_channel_ready(node_id_ref, msg_conv);
21480         uint64_t ret_ref = tag_ptr(ret_copy, true);
21481         return ret_ref;
21482 }
21483
21484 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_announcement_signatures"))) TS_MessageSendEvent_send_announcement_signatures(int8_tArray node_id, uint64_t msg) {
21485         LDKPublicKey node_id_ref;
21486         CHECK(node_id->arr_len == 33);
21487         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21488         LDKAnnouncementSignatures msg_conv;
21489         msg_conv.inner = untag_ptr(msg);
21490         msg_conv.is_owned = ptr_is_owned(msg);
21491         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21492         msg_conv = AnnouncementSignatures_clone(&msg_conv);
21493         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21494         *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
21495         uint64_t ret_ref = tag_ptr(ret_copy, true);
21496         return ret_ref;
21497 }
21498
21499 uint64_t  __attribute__((export_name("TS_MessageSendEvent_update_htlcs"))) TS_MessageSendEvent_update_htlcs(int8_tArray node_id, uint64_t updates) {
21500         LDKPublicKey node_id_ref;
21501         CHECK(node_id->arr_len == 33);
21502         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21503         LDKCommitmentUpdate updates_conv;
21504         updates_conv.inner = untag_ptr(updates);
21505         updates_conv.is_owned = ptr_is_owned(updates);
21506         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
21507         updates_conv = CommitmentUpdate_clone(&updates_conv);
21508         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21509         *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
21510         uint64_t ret_ref = tag_ptr(ret_copy, true);
21511         return ret_ref;
21512 }
21513
21514 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_revoke_and_ack"))) TS_MessageSendEvent_send_revoke_and_ack(int8_tArray node_id, uint64_t msg) {
21515         LDKPublicKey node_id_ref;
21516         CHECK(node_id->arr_len == 33);
21517         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21518         LDKRevokeAndACK msg_conv;
21519         msg_conv.inner = untag_ptr(msg);
21520         msg_conv.is_owned = ptr_is_owned(msg);
21521         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21522         msg_conv = RevokeAndACK_clone(&msg_conv);
21523         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21524         *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
21525         uint64_t ret_ref = tag_ptr(ret_copy, true);
21526         return ret_ref;
21527 }
21528
21529 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_closing_signed"))) TS_MessageSendEvent_send_closing_signed(int8_tArray node_id, uint64_t msg) {
21530         LDKPublicKey node_id_ref;
21531         CHECK(node_id->arr_len == 33);
21532         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21533         LDKClosingSigned msg_conv;
21534         msg_conv.inner = untag_ptr(msg);
21535         msg_conv.is_owned = ptr_is_owned(msg);
21536         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21537         msg_conv = ClosingSigned_clone(&msg_conv);
21538         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21539         *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
21540         uint64_t ret_ref = tag_ptr(ret_copy, true);
21541         return ret_ref;
21542 }
21543
21544 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_shutdown"))) TS_MessageSendEvent_send_shutdown(int8_tArray node_id, uint64_t msg) {
21545         LDKPublicKey node_id_ref;
21546         CHECK(node_id->arr_len == 33);
21547         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21548         LDKShutdown msg_conv;
21549         msg_conv.inner = untag_ptr(msg);
21550         msg_conv.is_owned = ptr_is_owned(msg);
21551         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21552         msg_conv = Shutdown_clone(&msg_conv);
21553         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21554         *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
21555         uint64_t ret_ref = tag_ptr(ret_copy, true);
21556         return ret_ref;
21557 }
21558
21559 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_reestablish"))) TS_MessageSendEvent_send_channel_reestablish(int8_tArray node_id, uint64_t msg) {
21560         LDKPublicKey node_id_ref;
21561         CHECK(node_id->arr_len == 33);
21562         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21563         LDKChannelReestablish msg_conv;
21564         msg_conv.inner = untag_ptr(msg);
21565         msg_conv.is_owned = ptr_is_owned(msg);
21566         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21567         msg_conv = ChannelReestablish_clone(&msg_conv);
21568         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21569         *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
21570         uint64_t ret_ref = tag_ptr(ret_copy, true);
21571         return ret_ref;
21572 }
21573
21574 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_announcement"))) TS_MessageSendEvent_send_channel_announcement(int8_tArray node_id, uint64_t msg, uint64_t update_msg) {
21575         LDKPublicKey node_id_ref;
21576         CHECK(node_id->arr_len == 33);
21577         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21578         LDKChannelAnnouncement msg_conv;
21579         msg_conv.inner = untag_ptr(msg);
21580         msg_conv.is_owned = ptr_is_owned(msg);
21581         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21582         msg_conv = ChannelAnnouncement_clone(&msg_conv);
21583         LDKChannelUpdate update_msg_conv;
21584         update_msg_conv.inner = untag_ptr(update_msg);
21585         update_msg_conv.is_owned = ptr_is_owned(update_msg);
21586         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
21587         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
21588         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21589         *ret_copy = MessageSendEvent_send_channel_announcement(node_id_ref, msg_conv, update_msg_conv);
21590         uint64_t ret_ref = tag_ptr(ret_copy, true);
21591         return ret_ref;
21592 }
21593
21594 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_announcement"))) TS_MessageSendEvent_broadcast_channel_announcement(uint64_t msg, uint64_t update_msg) {
21595         LDKChannelAnnouncement msg_conv;
21596         msg_conv.inner = untag_ptr(msg);
21597         msg_conv.is_owned = ptr_is_owned(msg);
21598         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21599         msg_conv = ChannelAnnouncement_clone(&msg_conv);
21600         LDKChannelUpdate update_msg_conv;
21601         update_msg_conv.inner = untag_ptr(update_msg);
21602         update_msg_conv.is_owned = ptr_is_owned(update_msg);
21603         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
21604         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
21605         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21606         *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
21607         uint64_t ret_ref = tag_ptr(ret_copy, true);
21608         return ret_ref;
21609 }
21610
21611 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_update"))) TS_MessageSendEvent_broadcast_channel_update(uint64_t msg) {
21612         LDKChannelUpdate msg_conv;
21613         msg_conv.inner = untag_ptr(msg);
21614         msg_conv.is_owned = ptr_is_owned(msg);
21615         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21616         msg_conv = ChannelUpdate_clone(&msg_conv);
21617         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21618         *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
21619         uint64_t ret_ref = tag_ptr(ret_copy, true);
21620         return ret_ref;
21621 }
21622
21623 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_update"))) TS_MessageSendEvent_send_channel_update(int8_tArray node_id, uint64_t msg) {
21624         LDKPublicKey node_id_ref;
21625         CHECK(node_id->arr_len == 33);
21626         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21627         LDKChannelUpdate msg_conv;
21628         msg_conv.inner = untag_ptr(msg);
21629         msg_conv.is_owned = ptr_is_owned(msg);
21630         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21631         msg_conv = ChannelUpdate_clone(&msg_conv);
21632         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21633         *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
21634         uint64_t ret_ref = tag_ptr(ret_copy, true);
21635         return ret_ref;
21636 }
21637
21638 uint64_t  __attribute__((export_name("TS_MessageSendEvent_handle_error"))) TS_MessageSendEvent_handle_error(int8_tArray node_id, uint64_t action) {
21639         LDKPublicKey node_id_ref;
21640         CHECK(node_id->arr_len == 33);
21641         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21642         void* action_ptr = untag_ptr(action);
21643         CHECK_ACCESS(action_ptr);
21644         LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
21645         action_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action));
21646         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21647         *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
21648         uint64_t ret_ref = tag_ptr(ret_copy, true);
21649         return ret_ref;
21650 }
21651
21652 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_range_query"))) TS_MessageSendEvent_send_channel_range_query(int8_tArray node_id, uint64_t msg) {
21653         LDKPublicKey node_id_ref;
21654         CHECK(node_id->arr_len == 33);
21655         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21656         LDKQueryChannelRange msg_conv;
21657         msg_conv.inner = untag_ptr(msg);
21658         msg_conv.is_owned = ptr_is_owned(msg);
21659         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21660         msg_conv = QueryChannelRange_clone(&msg_conv);
21661         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21662         *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
21663         uint64_t ret_ref = tag_ptr(ret_copy, true);
21664         return ret_ref;
21665 }
21666
21667 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_short_ids_query"))) TS_MessageSendEvent_send_short_ids_query(int8_tArray node_id, uint64_t msg) {
21668         LDKPublicKey node_id_ref;
21669         CHECK(node_id->arr_len == 33);
21670         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21671         LDKQueryShortChannelIds msg_conv;
21672         msg_conv.inner = untag_ptr(msg);
21673         msg_conv.is_owned = ptr_is_owned(msg);
21674         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21675         msg_conv = QueryShortChannelIds_clone(&msg_conv);
21676         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21677         *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
21678         uint64_t ret_ref = tag_ptr(ret_copy, true);
21679         return ret_ref;
21680 }
21681
21682 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_reply_channel_range"))) TS_MessageSendEvent_send_reply_channel_range(int8_tArray node_id, uint64_t msg) {
21683         LDKPublicKey node_id_ref;
21684         CHECK(node_id->arr_len == 33);
21685         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21686         LDKReplyChannelRange msg_conv;
21687         msg_conv.inner = untag_ptr(msg);
21688         msg_conv.is_owned = ptr_is_owned(msg);
21689         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21690         msg_conv = ReplyChannelRange_clone(&msg_conv);
21691         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21692         *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
21693         uint64_t ret_ref = tag_ptr(ret_copy, true);
21694         return ret_ref;
21695 }
21696
21697 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_gossip_timestamp_filter"))) TS_MessageSendEvent_send_gossip_timestamp_filter(int8_tArray node_id, uint64_t msg) {
21698         LDKPublicKey node_id_ref;
21699         CHECK(node_id->arr_len == 33);
21700         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21701         LDKGossipTimestampFilter msg_conv;
21702         msg_conv.inner = untag_ptr(msg);
21703         msg_conv.is_owned = ptr_is_owned(msg);
21704         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21705         msg_conv = GossipTimestampFilter_clone(&msg_conv);
21706         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21707         *ret_copy = MessageSendEvent_send_gossip_timestamp_filter(node_id_ref, msg_conv);
21708         uint64_t ret_ref = tag_ptr(ret_copy, true);
21709         return ret_ref;
21710 }
21711
21712 void  __attribute__((export_name("TS_MessageSendEventsProvider_free"))) TS_MessageSendEventsProvider_free(uint64_t this_ptr) {
21713         if (!ptr_is_owned(this_ptr)) return;
21714         void* this_ptr_ptr = untag_ptr(this_ptr);
21715         CHECK_ACCESS(this_ptr_ptr);
21716         LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
21717         FREE(untag_ptr(this_ptr));
21718         MessageSendEventsProvider_free(this_ptr_conv);
21719 }
21720
21721 void  __attribute__((export_name("TS_OnionMessageProvider_free"))) TS_OnionMessageProvider_free(uint64_t this_ptr) {
21722         if (!ptr_is_owned(this_ptr)) return;
21723         void* this_ptr_ptr = untag_ptr(this_ptr);
21724         CHECK_ACCESS(this_ptr_ptr);
21725         LDKOnionMessageProvider this_ptr_conv = *(LDKOnionMessageProvider*)(this_ptr_ptr);
21726         FREE(untag_ptr(this_ptr));
21727         OnionMessageProvider_free(this_ptr_conv);
21728 }
21729
21730 void  __attribute__((export_name("TS_EventsProvider_free"))) TS_EventsProvider_free(uint64_t this_ptr) {
21731         if (!ptr_is_owned(this_ptr)) return;
21732         void* this_ptr_ptr = untag_ptr(this_ptr);
21733         CHECK_ACCESS(this_ptr_ptr);
21734         LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
21735         FREE(untag_ptr(this_ptr));
21736         EventsProvider_free(this_ptr_conv);
21737 }
21738
21739 void  __attribute__((export_name("TS_EventHandler_free"))) TS_EventHandler_free(uint64_t this_ptr) {
21740         if (!ptr_is_owned(this_ptr)) return;
21741         void* this_ptr_ptr = untag_ptr(this_ptr);
21742         CHECK_ACCESS(this_ptr_ptr);
21743         LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
21744         FREE(untag_ptr(this_ptr));
21745         EventHandler_free(this_ptr_conv);
21746 }
21747
21748 void  __attribute__((export_name("TS_APIError_free"))) TS_APIError_free(uint64_t this_ptr) {
21749         if (!ptr_is_owned(this_ptr)) return;
21750         void* this_ptr_ptr = untag_ptr(this_ptr);
21751         CHECK_ACCESS(this_ptr_ptr);
21752         LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
21753         FREE(untag_ptr(this_ptr));
21754         APIError_free(this_ptr_conv);
21755 }
21756
21757 static inline uint64_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
21758         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
21759         *ret_copy = APIError_clone(arg);
21760         uint64_t ret_ref = tag_ptr(ret_copy, true);
21761         return ret_ref;
21762 }
21763 int64_t  __attribute__((export_name("TS_APIError_clone_ptr"))) TS_APIError_clone_ptr(uint64_t arg) {
21764         LDKAPIError* arg_conv = (LDKAPIError*)untag_ptr(arg);
21765         int64_t ret_conv = APIError_clone_ptr(arg_conv);
21766         return ret_conv;
21767 }
21768
21769 uint64_t  __attribute__((export_name("TS_APIError_clone"))) TS_APIError_clone(uint64_t orig) {
21770         LDKAPIError* orig_conv = (LDKAPIError*)untag_ptr(orig);
21771         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
21772         *ret_copy = APIError_clone(orig_conv);
21773         uint64_t ret_ref = tag_ptr(ret_copy, true);
21774         return ret_ref;
21775 }
21776
21777 uint64_t  __attribute__((export_name("TS_APIError_apimisuse_error"))) TS_APIError_apimisuse_error(jstring err) {
21778         LDKStr err_conv = str_ref_to_owned_c(err);
21779         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
21780         *ret_copy = APIError_apimisuse_error(err_conv);
21781         uint64_t ret_ref = tag_ptr(ret_copy, true);
21782         return ret_ref;
21783 }
21784
21785 uint64_t  __attribute__((export_name("TS_APIError_fee_rate_too_high"))) TS_APIError_fee_rate_too_high(jstring err, int32_t feerate) {
21786         LDKStr err_conv = str_ref_to_owned_c(err);
21787         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
21788         *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
21789         uint64_t ret_ref = tag_ptr(ret_copy, true);
21790         return ret_ref;
21791 }
21792
21793 uint64_t  __attribute__((export_name("TS_APIError_route_error"))) TS_APIError_route_error(jstring err) {
21794         LDKStr err_conv = str_ref_to_owned_c(err);
21795         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
21796         *ret_copy = APIError_route_error(err_conv);
21797         uint64_t ret_ref = tag_ptr(ret_copy, true);
21798         return ret_ref;
21799 }
21800
21801 uint64_t  __attribute__((export_name("TS_APIError_channel_unavailable"))) TS_APIError_channel_unavailable(jstring err) {
21802         LDKStr err_conv = str_ref_to_owned_c(err);
21803         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
21804         *ret_copy = APIError_channel_unavailable(err_conv);
21805         uint64_t ret_ref = tag_ptr(ret_copy, true);
21806         return ret_ref;
21807 }
21808
21809 uint64_t  __attribute__((export_name("TS_APIError_monitor_update_failed"))) TS_APIError_monitor_update_failed() {
21810         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
21811         *ret_copy = APIError_monitor_update_failed();
21812         uint64_t ret_ref = tag_ptr(ret_copy, true);
21813         return ret_ref;
21814 }
21815
21816 uint64_t  __attribute__((export_name("TS_APIError_incompatible_shutdown_script"))) TS_APIError_incompatible_shutdown_script(uint64_t script) {
21817         LDKShutdownScript script_conv;
21818         script_conv.inner = untag_ptr(script);
21819         script_conv.is_owned = ptr_is_owned(script);
21820         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
21821         script_conv = ShutdownScript_clone(&script_conv);
21822         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
21823         *ret_copy = APIError_incompatible_shutdown_script(script_conv);
21824         uint64_t ret_ref = tag_ptr(ret_copy, true);
21825         return ret_ref;
21826 }
21827
21828 void  __attribute__((export_name("TS_BigSize_free"))) TS_BigSize_free(uint64_t this_obj) {
21829         LDKBigSize this_obj_conv;
21830         this_obj_conv.inner = untag_ptr(this_obj);
21831         this_obj_conv.is_owned = ptr_is_owned(this_obj);
21832         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21833         BigSize_free(this_obj_conv);
21834 }
21835
21836 int64_t  __attribute__((export_name("TS_BigSize_get_a"))) TS_BigSize_get_a(uint64_t this_ptr) {
21837         LDKBigSize this_ptr_conv;
21838         this_ptr_conv.inner = untag_ptr(this_ptr);
21839         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21840         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21841         this_ptr_conv.is_owned = false;
21842         int64_t ret_conv = BigSize_get_a(&this_ptr_conv);
21843         return ret_conv;
21844 }
21845
21846 void  __attribute__((export_name("TS_BigSize_set_a"))) TS_BigSize_set_a(uint64_t this_ptr, int64_t val) {
21847         LDKBigSize this_ptr_conv;
21848         this_ptr_conv.inner = untag_ptr(this_ptr);
21849         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21851         this_ptr_conv.is_owned = false;
21852         BigSize_set_a(&this_ptr_conv, val);
21853 }
21854
21855 uint64_t  __attribute__((export_name("TS_BigSize_new"))) TS_BigSize_new(int64_t a_arg) {
21856         LDKBigSize ret_var = BigSize_new(a_arg);
21857         uint64_t ret_ref = 0;
21858         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21859         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21860         return ret_ref;
21861 }
21862
21863 void  __attribute__((export_name("TS_Hostname_free"))) TS_Hostname_free(uint64_t this_obj) {
21864         LDKHostname this_obj_conv;
21865         this_obj_conv.inner = untag_ptr(this_obj);
21866         this_obj_conv.is_owned = ptr_is_owned(this_obj);
21867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21868         Hostname_free(this_obj_conv);
21869 }
21870
21871 static inline uint64_t Hostname_clone_ptr(LDKHostname *NONNULL_PTR arg) {
21872         LDKHostname ret_var = Hostname_clone(arg);
21873         uint64_t ret_ref = 0;
21874         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21875         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21876         return ret_ref;
21877 }
21878 int64_t  __attribute__((export_name("TS_Hostname_clone_ptr"))) TS_Hostname_clone_ptr(uint64_t arg) {
21879         LDKHostname arg_conv;
21880         arg_conv.inner = untag_ptr(arg);
21881         arg_conv.is_owned = ptr_is_owned(arg);
21882         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
21883         arg_conv.is_owned = false;
21884         int64_t ret_conv = Hostname_clone_ptr(&arg_conv);
21885         return ret_conv;
21886 }
21887
21888 uint64_t  __attribute__((export_name("TS_Hostname_clone"))) TS_Hostname_clone(uint64_t orig) {
21889         LDKHostname orig_conv;
21890         orig_conv.inner = untag_ptr(orig);
21891         orig_conv.is_owned = ptr_is_owned(orig);
21892         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
21893         orig_conv.is_owned = false;
21894         LDKHostname ret_var = Hostname_clone(&orig_conv);
21895         uint64_t ret_ref = 0;
21896         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21897         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21898         return ret_ref;
21899 }
21900
21901 int8_t  __attribute__((export_name("TS_Hostname_len"))) TS_Hostname_len(uint64_t this_arg) {
21902         LDKHostname this_arg_conv;
21903         this_arg_conv.inner = untag_ptr(this_arg);
21904         this_arg_conv.is_owned = ptr_is_owned(this_arg);
21905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21906         this_arg_conv.is_owned = false;
21907         int8_t ret_conv = Hostname_len(&this_arg_conv);
21908         return ret_conv;
21909 }
21910
21911 uint64_t  __attribute__((export_name("TS_sign"))) TS_sign(int8_tArray msg, int8_tArray sk) {
21912         LDKu8slice msg_ref;
21913         msg_ref.datalen = msg->arr_len;
21914         msg_ref.data = msg->elems;
21915         unsigned char sk_arr[32];
21916         CHECK(sk->arr_len == 32);
21917         memcpy(sk_arr, sk->elems, 32); FREE(sk);
21918         unsigned char (*sk_ref)[32] = &sk_arr;
21919         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
21920         *ret_conv = sign(msg_ref, sk_ref);
21921         FREE(msg);
21922         return tag_ptr(ret_conv, true);
21923 }
21924
21925 uint64_t  __attribute__((export_name("TS_recover_pk"))) TS_recover_pk(int8_tArray msg, jstring sig) {
21926         LDKu8slice msg_ref;
21927         msg_ref.datalen = msg->arr_len;
21928         msg_ref.data = msg->elems;
21929         LDKStr sig_conv = str_ref_to_owned_c(sig);
21930         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
21931         *ret_conv = recover_pk(msg_ref, sig_conv);
21932         FREE(msg);
21933         return tag_ptr(ret_conv, true);
21934 }
21935
21936 jboolean  __attribute__((export_name("TS_verify"))) TS_verify(int8_tArray msg, jstring sig, int8_tArray pk) {
21937         LDKu8slice msg_ref;
21938         msg_ref.datalen = msg->arr_len;
21939         msg_ref.data = msg->elems;
21940         LDKStr sig_conv = str_ref_to_owned_c(sig);
21941         LDKPublicKey pk_ref;
21942         CHECK(pk->arr_len == 33);
21943         memcpy(pk_ref.compressed_form, pk->elems, 33); FREE(pk);
21944         jboolean ret_conv = verify(msg_ref, sig_conv, pk_ref);
21945         FREE(msg);
21946         return ret_conv;
21947 }
21948
21949 int8_tArray  __attribute__((export_name("TS_construct_invoice_preimage"))) TS_construct_invoice_preimage(int8_tArray hrp_bytes, ptrArray data_without_signature) {
21950         LDKu8slice hrp_bytes_ref;
21951         hrp_bytes_ref.datalen = hrp_bytes->arr_len;
21952         hrp_bytes_ref.data = hrp_bytes->elems;
21953         LDKCVec_u5Z data_without_signature_constr;
21954         data_without_signature_constr.datalen = data_without_signature->arr_len;
21955         if (data_without_signature_constr.datalen > 0)
21956                 data_without_signature_constr.data = MALLOC(data_without_signature_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
21957         else
21958                 data_without_signature_constr.data = NULL;
21959         int8_t* data_without_signature_vals = (void*) data_without_signature->elems;
21960         for (size_t h = 0; h < data_without_signature_constr.datalen; h++) {
21961                 int8_t data_without_signature_conv_7 = data_without_signature_vals[h];
21962                 
21963                 data_without_signature_constr.data[h] = (LDKu5){ ._0 = data_without_signature_conv_7 };
21964         }
21965         FREE(data_without_signature);
21966         LDKCVec_u8Z ret_var = construct_invoice_preimage(hrp_bytes_ref, data_without_signature_constr);
21967         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
21968         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
21969         CVec_u8Z_free(ret_var);
21970         FREE(hrp_bytes);
21971         return ret_arr;
21972 }
21973
21974 void  __attribute__((export_name("TS_Persister_free"))) TS_Persister_free(uint64_t this_ptr) {
21975         if (!ptr_is_owned(this_ptr)) return;
21976         void* this_ptr_ptr = untag_ptr(this_ptr);
21977         CHECK_ACCESS(this_ptr_ptr);
21978         LDKPersister this_ptr_conv = *(LDKPersister*)(this_ptr_ptr);
21979         FREE(untag_ptr(this_ptr));
21980         Persister_free(this_ptr_conv);
21981 }
21982
21983 void  __attribute__((export_name("TS_FutureCallback_free"))) TS_FutureCallback_free(uint64_t this_ptr) {
21984         if (!ptr_is_owned(this_ptr)) return;
21985         void* this_ptr_ptr = untag_ptr(this_ptr);
21986         CHECK_ACCESS(this_ptr_ptr);
21987         LDKFutureCallback this_ptr_conv = *(LDKFutureCallback*)(this_ptr_ptr);
21988         FREE(untag_ptr(this_ptr));
21989         FutureCallback_free(this_ptr_conv);
21990 }
21991
21992 void  __attribute__((export_name("TS_Future_free"))) TS_Future_free(uint64_t this_obj) {
21993         LDKFuture this_obj_conv;
21994         this_obj_conv.inner = untag_ptr(this_obj);
21995         this_obj_conv.is_owned = ptr_is_owned(this_obj);
21996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21997         Future_free(this_obj_conv);
21998 }
21999
22000 void  __attribute__((export_name("TS_Future_register_callback_fn"))) TS_Future_register_callback_fn(uint64_t this_arg, uint64_t callback) {
22001         LDKFuture this_arg_conv;
22002         this_arg_conv.inner = untag_ptr(this_arg);
22003         this_arg_conv.is_owned = ptr_is_owned(this_arg);
22004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22005         this_arg_conv.is_owned = false;
22006         void* callback_ptr = untag_ptr(callback);
22007         CHECK_ACCESS(callback_ptr);
22008         LDKFutureCallback callback_conv = *(LDKFutureCallback*)(callback_ptr);
22009         if (callback_conv.free == LDKFutureCallback_JCalls_free) {
22010                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22011                 LDKFutureCallback_JCalls_cloned(&callback_conv);
22012         }
22013         Future_register_callback_fn(&this_arg_conv, callback_conv);
22014 }
22015
22016 uint32_t  __attribute__((export_name("TS_Level_clone"))) TS_Level_clone(uint64_t orig) {
22017         LDKLevel* orig_conv = (LDKLevel*)untag_ptr(orig);
22018         uint32_t ret_conv = LDKLevel_to_js(Level_clone(orig_conv));
22019         return ret_conv;
22020 }
22021
22022 uint32_t  __attribute__((export_name("TS_Level_gossip"))) TS_Level_gossip() {
22023         uint32_t ret_conv = LDKLevel_to_js(Level_gossip());
22024         return ret_conv;
22025 }
22026
22027 uint32_t  __attribute__((export_name("TS_Level_trace"))) TS_Level_trace() {
22028         uint32_t ret_conv = LDKLevel_to_js(Level_trace());
22029         return ret_conv;
22030 }
22031
22032 uint32_t  __attribute__((export_name("TS_Level_debug"))) TS_Level_debug() {
22033         uint32_t ret_conv = LDKLevel_to_js(Level_debug());
22034         return ret_conv;
22035 }
22036
22037 uint32_t  __attribute__((export_name("TS_Level_info"))) TS_Level_info() {
22038         uint32_t ret_conv = LDKLevel_to_js(Level_info());
22039         return ret_conv;
22040 }
22041
22042 uint32_t  __attribute__((export_name("TS_Level_warn"))) TS_Level_warn() {
22043         uint32_t ret_conv = LDKLevel_to_js(Level_warn());
22044         return ret_conv;
22045 }
22046
22047 uint32_t  __attribute__((export_name("TS_Level_error"))) TS_Level_error() {
22048         uint32_t ret_conv = LDKLevel_to_js(Level_error());
22049         return ret_conv;
22050 }
22051
22052 jboolean  __attribute__((export_name("TS_Level_eq"))) TS_Level_eq(uint64_t a, uint64_t b) {
22053         LDKLevel* a_conv = (LDKLevel*)untag_ptr(a);
22054         LDKLevel* b_conv = (LDKLevel*)untag_ptr(b);
22055         jboolean ret_conv = Level_eq(a_conv, b_conv);
22056         return ret_conv;
22057 }
22058
22059 int64_t  __attribute__((export_name("TS_Level_hash"))) TS_Level_hash(uint64_t o) {
22060         LDKLevel* o_conv = (LDKLevel*)untag_ptr(o);
22061         int64_t ret_conv = Level_hash(o_conv);
22062         return ret_conv;
22063 }
22064
22065 uint32_t  __attribute__((export_name("TS_Level_max"))) TS_Level_max() {
22066         uint32_t ret_conv = LDKLevel_to_js(Level_max());
22067         return ret_conv;
22068 }
22069
22070 void  __attribute__((export_name("TS_Record_free"))) TS_Record_free(uint64_t this_obj) {
22071         LDKRecord this_obj_conv;
22072         this_obj_conv.inner = untag_ptr(this_obj);
22073         this_obj_conv.is_owned = ptr_is_owned(this_obj);
22074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22075         Record_free(this_obj_conv);
22076 }
22077
22078 uint32_t  __attribute__((export_name("TS_Record_get_level"))) TS_Record_get_level(uint64_t this_ptr) {
22079         LDKRecord this_ptr_conv;
22080         this_ptr_conv.inner = untag_ptr(this_ptr);
22081         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22083         this_ptr_conv.is_owned = false;
22084         uint32_t ret_conv = LDKLevel_to_js(Record_get_level(&this_ptr_conv));
22085         return ret_conv;
22086 }
22087
22088 void  __attribute__((export_name("TS_Record_set_level"))) TS_Record_set_level(uint64_t this_ptr, uint32_t val) {
22089         LDKRecord this_ptr_conv;
22090         this_ptr_conv.inner = untag_ptr(this_ptr);
22091         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22093         this_ptr_conv.is_owned = false;
22094         LDKLevel val_conv = LDKLevel_from_js(val);
22095         Record_set_level(&this_ptr_conv, val_conv);
22096 }
22097
22098 jstring  __attribute__((export_name("TS_Record_get_args"))) TS_Record_get_args(uint64_t this_ptr) {
22099         LDKRecord this_ptr_conv;
22100         this_ptr_conv.inner = untag_ptr(this_ptr);
22101         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22103         this_ptr_conv.is_owned = false;
22104         LDKStr ret_str = Record_get_args(&this_ptr_conv);
22105         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
22106         Str_free(ret_str);
22107         return ret_conv;
22108 }
22109
22110 void  __attribute__((export_name("TS_Record_set_args"))) TS_Record_set_args(uint64_t this_ptr, jstring val) {
22111         LDKRecord this_ptr_conv;
22112         this_ptr_conv.inner = untag_ptr(this_ptr);
22113         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22115         this_ptr_conv.is_owned = false;
22116         LDKStr val_conv = str_ref_to_owned_c(val);
22117         Record_set_args(&this_ptr_conv, val_conv);
22118 }
22119
22120 jstring  __attribute__((export_name("TS_Record_get_module_path"))) TS_Record_get_module_path(uint64_t this_ptr) {
22121         LDKRecord this_ptr_conv;
22122         this_ptr_conv.inner = untag_ptr(this_ptr);
22123         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22125         this_ptr_conv.is_owned = false;
22126         LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
22127         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
22128         Str_free(ret_str);
22129         return ret_conv;
22130 }
22131
22132 void  __attribute__((export_name("TS_Record_set_module_path"))) TS_Record_set_module_path(uint64_t this_ptr, jstring val) {
22133         LDKRecord this_ptr_conv;
22134         this_ptr_conv.inner = untag_ptr(this_ptr);
22135         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22137         this_ptr_conv.is_owned = false;
22138         LDKStr val_conv = str_ref_to_owned_c(val);
22139         Record_set_module_path(&this_ptr_conv, val_conv);
22140 }
22141
22142 jstring  __attribute__((export_name("TS_Record_get_file"))) TS_Record_get_file(uint64_t this_ptr) {
22143         LDKRecord this_ptr_conv;
22144         this_ptr_conv.inner = untag_ptr(this_ptr);
22145         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22147         this_ptr_conv.is_owned = false;
22148         LDKStr ret_str = Record_get_file(&this_ptr_conv);
22149         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
22150         Str_free(ret_str);
22151         return ret_conv;
22152 }
22153
22154 void  __attribute__((export_name("TS_Record_set_file"))) TS_Record_set_file(uint64_t this_ptr, jstring val) {
22155         LDKRecord this_ptr_conv;
22156         this_ptr_conv.inner = untag_ptr(this_ptr);
22157         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22159         this_ptr_conv.is_owned = false;
22160         LDKStr val_conv = str_ref_to_owned_c(val);
22161         Record_set_file(&this_ptr_conv, val_conv);
22162 }
22163
22164 int32_t  __attribute__((export_name("TS_Record_get_line"))) TS_Record_get_line(uint64_t this_ptr) {
22165         LDKRecord this_ptr_conv;
22166         this_ptr_conv.inner = untag_ptr(this_ptr);
22167         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22169         this_ptr_conv.is_owned = false;
22170         int32_t ret_conv = Record_get_line(&this_ptr_conv);
22171         return ret_conv;
22172 }
22173
22174 void  __attribute__((export_name("TS_Record_set_line"))) TS_Record_set_line(uint64_t this_ptr, int32_t val) {
22175         LDKRecord this_ptr_conv;
22176         this_ptr_conv.inner = untag_ptr(this_ptr);
22177         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22179         this_ptr_conv.is_owned = false;
22180         Record_set_line(&this_ptr_conv, val);
22181 }
22182
22183 static inline uint64_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
22184         LDKRecord ret_var = Record_clone(arg);
22185         uint64_t ret_ref = 0;
22186         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22187         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22188         return ret_ref;
22189 }
22190 int64_t  __attribute__((export_name("TS_Record_clone_ptr"))) TS_Record_clone_ptr(uint64_t arg) {
22191         LDKRecord arg_conv;
22192         arg_conv.inner = untag_ptr(arg);
22193         arg_conv.is_owned = ptr_is_owned(arg);
22194         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22195         arg_conv.is_owned = false;
22196         int64_t ret_conv = Record_clone_ptr(&arg_conv);
22197         return ret_conv;
22198 }
22199
22200 uint64_t  __attribute__((export_name("TS_Record_clone"))) TS_Record_clone(uint64_t orig) {
22201         LDKRecord orig_conv;
22202         orig_conv.inner = untag_ptr(orig);
22203         orig_conv.is_owned = ptr_is_owned(orig);
22204         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22205         orig_conv.is_owned = false;
22206         LDKRecord ret_var = Record_clone(&orig_conv);
22207         uint64_t ret_ref = 0;
22208         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22209         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22210         return ret_ref;
22211 }
22212
22213 void  __attribute__((export_name("TS_Logger_free"))) TS_Logger_free(uint64_t this_ptr) {
22214         if (!ptr_is_owned(this_ptr)) return;
22215         void* this_ptr_ptr = untag_ptr(this_ptr);
22216         CHECK_ACCESS(this_ptr_ptr);
22217         LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
22218         FREE(untag_ptr(this_ptr));
22219         Logger_free(this_ptr_conv);
22220 }
22221
22222 void  __attribute__((export_name("TS_ChannelHandshakeConfig_free"))) TS_ChannelHandshakeConfig_free(uint64_t this_obj) {
22223         LDKChannelHandshakeConfig this_obj_conv;
22224         this_obj_conv.inner = untag_ptr(this_obj);
22225         this_obj_conv.is_owned = ptr_is_owned(this_obj);
22226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22227         ChannelHandshakeConfig_free(this_obj_conv);
22228 }
22229
22230 int32_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_minimum_depth"))) TS_ChannelHandshakeConfig_get_minimum_depth(uint64_t this_ptr) {
22231         LDKChannelHandshakeConfig this_ptr_conv;
22232         this_ptr_conv.inner = untag_ptr(this_ptr);
22233         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22235         this_ptr_conv.is_owned = false;
22236         int32_t ret_conv = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
22237         return ret_conv;
22238 }
22239
22240 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_minimum_depth"))) TS_ChannelHandshakeConfig_set_minimum_depth(uint64_t this_ptr, int32_t val) {
22241         LDKChannelHandshakeConfig this_ptr_conv;
22242         this_ptr_conv.inner = untag_ptr(this_ptr);
22243         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22245         this_ptr_conv.is_owned = false;
22246         ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
22247 }
22248
22249 int16_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_to_self_delay"))) TS_ChannelHandshakeConfig_get_our_to_self_delay(uint64_t this_ptr) {
22250         LDKChannelHandshakeConfig this_ptr_conv;
22251         this_ptr_conv.inner = untag_ptr(this_ptr);
22252         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22254         this_ptr_conv.is_owned = false;
22255         int16_t ret_conv = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
22256         return ret_conv;
22257 }
22258
22259 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) {
22260         LDKChannelHandshakeConfig this_ptr_conv;
22261         this_ptr_conv.inner = untag_ptr(this_ptr);
22262         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22264         this_ptr_conv.is_owned = false;
22265         ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
22266 }
22267
22268 int64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat"))) TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat(uint64_t this_ptr) {
22269         LDKChannelHandshakeConfig this_ptr_conv;
22270         this_ptr_conv.inner = untag_ptr(this_ptr);
22271         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22273         this_ptr_conv.is_owned = false;
22274         int64_t ret_conv = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
22275         return ret_conv;
22276 }
22277
22278 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) {
22279         LDKChannelHandshakeConfig this_ptr_conv;
22280         this_ptr_conv.inner = untag_ptr(this_ptr);
22281         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22283         this_ptr_conv.is_owned = false;
22284         ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
22285 }
22286
22287 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) {
22288         LDKChannelHandshakeConfig this_ptr_conv;
22289         this_ptr_conv.inner = untag_ptr(this_ptr);
22290         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22291         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22292         this_ptr_conv.is_owned = false;
22293         int8_t ret_conv = ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv);
22294         return ret_conv;
22295 }
22296
22297 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) {
22298         LDKChannelHandshakeConfig this_ptr_conv;
22299         this_ptr_conv.inner = untag_ptr(this_ptr);
22300         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22302         this_ptr_conv.is_owned = false;
22303         ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv, val);
22304 }
22305
22306 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_negotiate_scid_privacy"))) TS_ChannelHandshakeConfig_get_negotiate_scid_privacy(uint64_t this_ptr) {
22307         LDKChannelHandshakeConfig this_ptr_conv;
22308         this_ptr_conv.inner = untag_ptr(this_ptr);
22309         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22310         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22311         this_ptr_conv.is_owned = false;
22312         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_scid_privacy(&this_ptr_conv);
22313         return ret_conv;
22314 }
22315
22316 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_negotiate_scid_privacy"))) TS_ChannelHandshakeConfig_set_negotiate_scid_privacy(uint64_t this_ptr, jboolean val) {
22317         LDKChannelHandshakeConfig this_ptr_conv;
22318         this_ptr_conv.inner = untag_ptr(this_ptr);
22319         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22321         this_ptr_conv.is_owned = false;
22322         ChannelHandshakeConfig_set_negotiate_scid_privacy(&this_ptr_conv, val);
22323 }
22324
22325 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_announced_channel"))) TS_ChannelHandshakeConfig_get_announced_channel(uint64_t this_ptr) {
22326         LDKChannelHandshakeConfig this_ptr_conv;
22327         this_ptr_conv.inner = untag_ptr(this_ptr);
22328         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22330         this_ptr_conv.is_owned = false;
22331         jboolean ret_conv = ChannelHandshakeConfig_get_announced_channel(&this_ptr_conv);
22332         return ret_conv;
22333 }
22334
22335 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_announced_channel"))) TS_ChannelHandshakeConfig_set_announced_channel(uint64_t this_ptr, jboolean val) {
22336         LDKChannelHandshakeConfig this_ptr_conv;
22337         this_ptr_conv.inner = untag_ptr(this_ptr);
22338         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22340         this_ptr_conv.is_owned = false;
22341         ChannelHandshakeConfig_set_announced_channel(&this_ptr_conv, val);
22342 }
22343
22344 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey"))) TS_ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(uint64_t this_ptr) {
22345         LDKChannelHandshakeConfig this_ptr_conv;
22346         this_ptr_conv.inner = untag_ptr(this_ptr);
22347         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22349         this_ptr_conv.is_owned = false;
22350         jboolean ret_conv = ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
22351         return ret_conv;
22352 }
22353
22354 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey"))) TS_ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(uint64_t this_ptr, jboolean val) {
22355         LDKChannelHandshakeConfig this_ptr_conv;
22356         this_ptr_conv.inner = untag_ptr(this_ptr);
22357         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22359         this_ptr_conv.is_owned = false;
22360         ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
22361 }
22362
22363 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) {
22364         LDKChannelHandshakeConfig this_ptr_conv;
22365         this_ptr_conv.inner = untag_ptr(this_ptr);
22366         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22368         this_ptr_conv.is_owned = false;
22369         int32_t ret_conv = ChannelHandshakeConfig_get_their_channel_reserve_proportional_millionths(&this_ptr_conv);
22370         return ret_conv;
22371 }
22372
22373 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) {
22374         LDKChannelHandshakeConfig this_ptr_conv;
22375         this_ptr_conv.inner = untag_ptr(this_ptr);
22376         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22378         this_ptr_conv.is_owned = false;
22379         ChannelHandshakeConfig_set_their_channel_reserve_proportional_millionths(&this_ptr_conv, val);
22380 }
22381
22382 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) {
22383         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);
22384         uint64_t ret_ref = 0;
22385         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22386         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22387         return ret_ref;
22388 }
22389
22390 static inline uint64_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
22391         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
22392         uint64_t ret_ref = 0;
22393         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22394         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22395         return ret_ref;
22396 }
22397 int64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_clone_ptr"))) TS_ChannelHandshakeConfig_clone_ptr(uint64_t arg) {
22398         LDKChannelHandshakeConfig arg_conv;
22399         arg_conv.inner = untag_ptr(arg);
22400         arg_conv.is_owned = ptr_is_owned(arg);
22401         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22402         arg_conv.is_owned = false;
22403         int64_t ret_conv = ChannelHandshakeConfig_clone_ptr(&arg_conv);
22404         return ret_conv;
22405 }
22406
22407 uint64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_clone"))) TS_ChannelHandshakeConfig_clone(uint64_t orig) {
22408         LDKChannelHandshakeConfig orig_conv;
22409         orig_conv.inner = untag_ptr(orig);
22410         orig_conv.is_owned = ptr_is_owned(orig);
22411         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22412         orig_conv.is_owned = false;
22413         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
22414         uint64_t ret_ref = 0;
22415         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22416         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22417         return ret_ref;
22418 }
22419
22420 uint64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_default"))) TS_ChannelHandshakeConfig_default() {
22421         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
22422         uint64_t ret_ref = 0;
22423         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22424         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22425         return ret_ref;
22426 }
22427
22428 void  __attribute__((export_name("TS_ChannelHandshakeLimits_free"))) TS_ChannelHandshakeLimits_free(uint64_t this_obj) {
22429         LDKChannelHandshakeLimits this_obj_conv;
22430         this_obj_conv.inner = untag_ptr(this_obj);
22431         this_obj_conv.is_owned = ptr_is_owned(this_obj);
22432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22433         ChannelHandshakeLimits_free(this_obj_conv);
22434 }
22435
22436 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_funding_satoshis"))) TS_ChannelHandshakeLimits_get_min_funding_satoshis(uint64_t this_ptr) {
22437         LDKChannelHandshakeLimits this_ptr_conv;
22438         this_ptr_conv.inner = untag_ptr(this_ptr);
22439         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22441         this_ptr_conv.is_owned = false;
22442         int64_t ret_conv = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
22443         return ret_conv;
22444 }
22445
22446 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_min_funding_satoshis"))) TS_ChannelHandshakeLimits_set_min_funding_satoshis(uint64_t this_ptr, int64_t val) {
22447         LDKChannelHandshakeLimits this_ptr_conv;
22448         this_ptr_conv.inner = untag_ptr(this_ptr);
22449         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22451         this_ptr_conv.is_owned = false;
22452         ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
22453 }
22454
22455 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_funding_satoshis"))) TS_ChannelHandshakeLimits_get_max_funding_satoshis(uint64_t this_ptr) {
22456         LDKChannelHandshakeLimits this_ptr_conv;
22457         this_ptr_conv.inner = untag_ptr(this_ptr);
22458         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22460         this_ptr_conv.is_owned = false;
22461         int64_t ret_conv = ChannelHandshakeLimits_get_max_funding_satoshis(&this_ptr_conv);
22462         return ret_conv;
22463 }
22464
22465 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_funding_satoshis"))) TS_ChannelHandshakeLimits_set_max_funding_satoshis(uint64_t this_ptr, int64_t val) {
22466         LDKChannelHandshakeLimits this_ptr_conv;
22467         this_ptr_conv.inner = untag_ptr(this_ptr);
22468         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22470         this_ptr_conv.is_owned = false;
22471         ChannelHandshakeLimits_set_max_funding_satoshis(&this_ptr_conv, val);
22472 }
22473
22474 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat"))) TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat(uint64_t this_ptr) {
22475         LDKChannelHandshakeLimits this_ptr_conv;
22476         this_ptr_conv.inner = untag_ptr(this_ptr);
22477         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22478         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22479         this_ptr_conv.is_owned = false;
22480         int64_t ret_conv = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
22481         return ret_conv;
22482 }
22483
22484 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) {
22485         LDKChannelHandshakeLimits this_ptr_conv;
22486         this_ptr_conv.inner = untag_ptr(this_ptr);
22487         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22489         this_ptr_conv.is_owned = false;
22490         ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
22491 }
22492
22493 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) {
22494         LDKChannelHandshakeLimits this_ptr_conv;
22495         this_ptr_conv.inner = untag_ptr(this_ptr);
22496         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22497         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22498         this_ptr_conv.is_owned = false;
22499         int64_t ret_conv = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
22500         return ret_conv;
22501 }
22502
22503 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) {
22504         LDKChannelHandshakeLimits this_ptr_conv;
22505         this_ptr_conv.inner = untag_ptr(this_ptr);
22506         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22507         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22508         this_ptr_conv.is_owned = false;
22509         ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
22510 }
22511
22512 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis"))) TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis(uint64_t this_ptr) {
22513         LDKChannelHandshakeLimits this_ptr_conv;
22514         this_ptr_conv.inner = untag_ptr(this_ptr);
22515         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22517         this_ptr_conv.is_owned = false;
22518         int64_t ret_conv = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
22519         return ret_conv;
22520 }
22521
22522 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) {
22523         LDKChannelHandshakeLimits this_ptr_conv;
22524         this_ptr_conv.inner = untag_ptr(this_ptr);
22525         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22527         this_ptr_conv.is_owned = false;
22528         ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
22529 }
22530
22531 int16_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs"))) TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs(uint64_t this_ptr) {
22532         LDKChannelHandshakeLimits this_ptr_conv;
22533         this_ptr_conv.inner = untag_ptr(this_ptr);
22534         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22536         this_ptr_conv.is_owned = false;
22537         int16_t ret_conv = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
22538         return ret_conv;
22539 }
22540
22541 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) {
22542         LDKChannelHandshakeLimits this_ptr_conv;
22543         this_ptr_conv.inner = untag_ptr(this_ptr);
22544         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22546         this_ptr_conv.is_owned = false;
22547         ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
22548 }
22549
22550 int32_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_minimum_depth"))) TS_ChannelHandshakeLimits_get_max_minimum_depth(uint64_t this_ptr) {
22551         LDKChannelHandshakeLimits this_ptr_conv;
22552         this_ptr_conv.inner = untag_ptr(this_ptr);
22553         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22555         this_ptr_conv.is_owned = false;
22556         int32_t ret_conv = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
22557         return ret_conv;
22558 }
22559
22560 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_minimum_depth"))) TS_ChannelHandshakeLimits_set_max_minimum_depth(uint64_t this_ptr, int32_t val) {
22561         LDKChannelHandshakeLimits this_ptr_conv;
22562         this_ptr_conv.inner = untag_ptr(this_ptr);
22563         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22565         this_ptr_conv.is_owned = false;
22566         ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
22567 }
22568
22569 jboolean  __attribute__((export_name("TS_ChannelHandshakeLimits_get_trust_own_funding_0conf"))) TS_ChannelHandshakeLimits_get_trust_own_funding_0conf(uint64_t this_ptr) {
22570         LDKChannelHandshakeLimits this_ptr_conv;
22571         this_ptr_conv.inner = untag_ptr(this_ptr);
22572         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22574         this_ptr_conv.is_owned = false;
22575         jboolean ret_conv = ChannelHandshakeLimits_get_trust_own_funding_0conf(&this_ptr_conv);
22576         return ret_conv;
22577 }
22578
22579 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_trust_own_funding_0conf"))) TS_ChannelHandshakeLimits_set_trust_own_funding_0conf(uint64_t this_ptr, jboolean val) {
22580         LDKChannelHandshakeLimits this_ptr_conv;
22581         this_ptr_conv.inner = untag_ptr(this_ptr);
22582         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22584         this_ptr_conv.is_owned = false;
22585         ChannelHandshakeLimits_set_trust_own_funding_0conf(&this_ptr_conv, val);
22586 }
22587
22588 jboolean  __attribute__((export_name("TS_ChannelHandshakeLimits_get_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_get_force_announced_channel_preference(uint64_t this_ptr) {
22589         LDKChannelHandshakeLimits this_ptr_conv;
22590         this_ptr_conv.inner = untag_ptr(this_ptr);
22591         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22593         this_ptr_conv.is_owned = false;
22594         jboolean ret_conv = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
22595         return ret_conv;
22596 }
22597
22598 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_set_force_announced_channel_preference(uint64_t this_ptr, jboolean val) {
22599         LDKChannelHandshakeLimits this_ptr_conv;
22600         this_ptr_conv.inner = untag_ptr(this_ptr);
22601         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22603         this_ptr_conv.is_owned = false;
22604         ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
22605 }
22606
22607 int16_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_their_to_self_delay"))) TS_ChannelHandshakeLimits_get_their_to_self_delay(uint64_t this_ptr) {
22608         LDKChannelHandshakeLimits this_ptr_conv;
22609         this_ptr_conv.inner = untag_ptr(this_ptr);
22610         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22612         this_ptr_conv.is_owned = false;
22613         int16_t ret_conv = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
22614         return ret_conv;
22615 }
22616
22617 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) {
22618         LDKChannelHandshakeLimits this_ptr_conv;
22619         this_ptr_conv.inner = untag_ptr(this_ptr);
22620         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22622         this_ptr_conv.is_owned = false;
22623         ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
22624 }
22625
22626 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) {
22627         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);
22628         uint64_t ret_ref = 0;
22629         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22630         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22631         return ret_ref;
22632 }
22633
22634 static inline uint64_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
22635         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
22636         uint64_t ret_ref = 0;
22637         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22638         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22639         return ret_ref;
22640 }
22641 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_clone_ptr"))) TS_ChannelHandshakeLimits_clone_ptr(uint64_t arg) {
22642         LDKChannelHandshakeLimits arg_conv;
22643         arg_conv.inner = untag_ptr(arg);
22644         arg_conv.is_owned = ptr_is_owned(arg);
22645         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22646         arg_conv.is_owned = false;
22647         int64_t ret_conv = ChannelHandshakeLimits_clone_ptr(&arg_conv);
22648         return ret_conv;
22649 }
22650
22651 uint64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_clone"))) TS_ChannelHandshakeLimits_clone(uint64_t orig) {
22652         LDKChannelHandshakeLimits orig_conv;
22653         orig_conv.inner = untag_ptr(orig);
22654         orig_conv.is_owned = ptr_is_owned(orig);
22655         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22656         orig_conv.is_owned = false;
22657         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
22658         uint64_t ret_ref = 0;
22659         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22660         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22661         return ret_ref;
22662 }
22663
22664 uint64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_default"))) TS_ChannelHandshakeLimits_default() {
22665         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
22666         uint64_t ret_ref = 0;
22667         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22668         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22669         return ret_ref;
22670 }
22671
22672 void  __attribute__((export_name("TS_ChannelConfig_free"))) TS_ChannelConfig_free(uint64_t this_obj) {
22673         LDKChannelConfig this_obj_conv;
22674         this_obj_conv.inner = untag_ptr(this_obj);
22675         this_obj_conv.is_owned = ptr_is_owned(this_obj);
22676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22677         ChannelConfig_free(this_obj_conv);
22678 }
22679
22680 int32_t  __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_proportional_millionths"))) TS_ChannelConfig_get_forwarding_fee_proportional_millionths(uint64_t this_ptr) {
22681         LDKChannelConfig this_ptr_conv;
22682         this_ptr_conv.inner = untag_ptr(this_ptr);
22683         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22685         this_ptr_conv.is_owned = false;
22686         int32_t ret_conv = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
22687         return ret_conv;
22688 }
22689
22690 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) {
22691         LDKChannelConfig this_ptr_conv;
22692         this_ptr_conv.inner = untag_ptr(this_ptr);
22693         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22695         this_ptr_conv.is_owned = false;
22696         ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
22697 }
22698
22699 int32_t  __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_base_msat"))) TS_ChannelConfig_get_forwarding_fee_base_msat(uint64_t this_ptr) {
22700         LDKChannelConfig this_ptr_conv;
22701         this_ptr_conv.inner = untag_ptr(this_ptr);
22702         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22704         this_ptr_conv.is_owned = false;
22705         int32_t ret_conv = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
22706         return ret_conv;
22707 }
22708
22709 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) {
22710         LDKChannelConfig this_ptr_conv;
22711         this_ptr_conv.inner = untag_ptr(this_ptr);
22712         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22714         this_ptr_conv.is_owned = false;
22715         ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
22716 }
22717
22718 int16_t  __attribute__((export_name("TS_ChannelConfig_get_cltv_expiry_delta"))) TS_ChannelConfig_get_cltv_expiry_delta(uint64_t this_ptr) {
22719         LDKChannelConfig this_ptr_conv;
22720         this_ptr_conv.inner = untag_ptr(this_ptr);
22721         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22723         this_ptr_conv.is_owned = false;
22724         int16_t ret_conv = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
22725         return ret_conv;
22726 }
22727
22728 void  __attribute__((export_name("TS_ChannelConfig_set_cltv_expiry_delta"))) TS_ChannelConfig_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
22729         LDKChannelConfig this_ptr_conv;
22730         this_ptr_conv.inner = untag_ptr(this_ptr);
22731         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22733         this_ptr_conv.is_owned = false;
22734         ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
22735 }
22736
22737 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) {
22738         LDKChannelConfig this_ptr_conv;
22739         this_ptr_conv.inner = untag_ptr(this_ptr);
22740         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22742         this_ptr_conv.is_owned = false;
22743         int64_t ret_conv = ChannelConfig_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
22744         return ret_conv;
22745 }
22746
22747 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) {
22748         LDKChannelConfig this_ptr_conv;
22749         this_ptr_conv.inner = untag_ptr(this_ptr);
22750         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22752         this_ptr_conv.is_owned = false;
22753         ChannelConfig_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val);
22754 }
22755
22756 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) {
22757         LDKChannelConfig this_ptr_conv;
22758         this_ptr_conv.inner = untag_ptr(this_ptr);
22759         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22761         this_ptr_conv.is_owned = false;
22762         int64_t ret_conv = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
22763         return ret_conv;
22764 }
22765
22766 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) {
22767         LDKChannelConfig this_ptr_conv;
22768         this_ptr_conv.inner = untag_ptr(this_ptr);
22769         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22771         this_ptr_conv.is_owned = false;
22772         ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
22773 }
22774
22775 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) {
22776         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);
22777         uint64_t ret_ref = 0;
22778         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22779         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22780         return ret_ref;
22781 }
22782
22783 static inline uint64_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
22784         LDKChannelConfig ret_var = ChannelConfig_clone(arg);
22785         uint64_t ret_ref = 0;
22786         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22787         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22788         return ret_ref;
22789 }
22790 int64_t  __attribute__((export_name("TS_ChannelConfig_clone_ptr"))) TS_ChannelConfig_clone_ptr(uint64_t arg) {
22791         LDKChannelConfig arg_conv;
22792         arg_conv.inner = untag_ptr(arg);
22793         arg_conv.is_owned = ptr_is_owned(arg);
22794         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22795         arg_conv.is_owned = false;
22796         int64_t ret_conv = ChannelConfig_clone_ptr(&arg_conv);
22797         return ret_conv;
22798 }
22799
22800 uint64_t  __attribute__((export_name("TS_ChannelConfig_clone"))) TS_ChannelConfig_clone(uint64_t orig) {
22801         LDKChannelConfig orig_conv;
22802         orig_conv.inner = untag_ptr(orig);
22803         orig_conv.is_owned = ptr_is_owned(orig);
22804         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22805         orig_conv.is_owned = false;
22806         LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
22807         uint64_t ret_ref = 0;
22808         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22809         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22810         return ret_ref;
22811 }
22812
22813 uint64_t  __attribute__((export_name("TS_ChannelConfig_default"))) TS_ChannelConfig_default() {
22814         LDKChannelConfig ret_var = ChannelConfig_default();
22815         uint64_t ret_ref = 0;
22816         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22817         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22818         return ret_ref;
22819 }
22820
22821 int8_tArray  __attribute__((export_name("TS_ChannelConfig_write"))) TS_ChannelConfig_write(uint64_t obj) {
22822         LDKChannelConfig obj_conv;
22823         obj_conv.inner = untag_ptr(obj);
22824         obj_conv.is_owned = ptr_is_owned(obj);
22825         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
22826         obj_conv.is_owned = false;
22827         LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
22828         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
22829         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
22830         CVec_u8Z_free(ret_var);
22831         return ret_arr;
22832 }
22833
22834 uint64_t  __attribute__((export_name("TS_ChannelConfig_read"))) TS_ChannelConfig_read(int8_tArray ser) {
22835         LDKu8slice ser_ref;
22836         ser_ref.datalen = ser->arr_len;
22837         ser_ref.data = ser->elems;
22838         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
22839         *ret_conv = ChannelConfig_read(ser_ref);
22840         FREE(ser);
22841         return tag_ptr(ret_conv, true);
22842 }
22843
22844 void  __attribute__((export_name("TS_UserConfig_free"))) TS_UserConfig_free(uint64_t this_obj) {
22845         LDKUserConfig this_obj_conv;
22846         this_obj_conv.inner = untag_ptr(this_obj);
22847         this_obj_conv.is_owned = ptr_is_owned(this_obj);
22848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22849         UserConfig_free(this_obj_conv);
22850 }
22851
22852 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_handshake_config"))) TS_UserConfig_get_channel_handshake_config(uint64_t this_ptr) {
22853         LDKUserConfig this_ptr_conv;
22854         this_ptr_conv.inner = untag_ptr(this_ptr);
22855         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22857         this_ptr_conv.is_owned = false;
22858         LDKChannelHandshakeConfig ret_var = UserConfig_get_channel_handshake_config(&this_ptr_conv);
22859         uint64_t ret_ref = 0;
22860         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22861         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22862         return ret_ref;
22863 }
22864
22865 void  __attribute__((export_name("TS_UserConfig_set_channel_handshake_config"))) TS_UserConfig_set_channel_handshake_config(uint64_t this_ptr, uint64_t val) {
22866         LDKUserConfig this_ptr_conv;
22867         this_ptr_conv.inner = untag_ptr(this_ptr);
22868         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22870         this_ptr_conv.is_owned = false;
22871         LDKChannelHandshakeConfig val_conv;
22872         val_conv.inner = untag_ptr(val);
22873         val_conv.is_owned = ptr_is_owned(val);
22874         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
22875         val_conv = ChannelHandshakeConfig_clone(&val_conv);
22876         UserConfig_set_channel_handshake_config(&this_ptr_conv, val_conv);
22877 }
22878
22879 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_handshake_limits"))) TS_UserConfig_get_channel_handshake_limits(uint64_t this_ptr) {
22880         LDKUserConfig this_ptr_conv;
22881         this_ptr_conv.inner = untag_ptr(this_ptr);
22882         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22883         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22884         this_ptr_conv.is_owned = false;
22885         LDKChannelHandshakeLimits ret_var = UserConfig_get_channel_handshake_limits(&this_ptr_conv);
22886         uint64_t ret_ref = 0;
22887         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22888         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22889         return ret_ref;
22890 }
22891
22892 void  __attribute__((export_name("TS_UserConfig_set_channel_handshake_limits"))) TS_UserConfig_set_channel_handshake_limits(uint64_t this_ptr, uint64_t val) {
22893         LDKUserConfig this_ptr_conv;
22894         this_ptr_conv.inner = untag_ptr(this_ptr);
22895         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22896         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22897         this_ptr_conv.is_owned = false;
22898         LDKChannelHandshakeLimits val_conv;
22899         val_conv.inner = untag_ptr(val);
22900         val_conv.is_owned = ptr_is_owned(val);
22901         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
22902         val_conv = ChannelHandshakeLimits_clone(&val_conv);
22903         UserConfig_set_channel_handshake_limits(&this_ptr_conv, val_conv);
22904 }
22905
22906 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_config"))) TS_UserConfig_get_channel_config(uint64_t this_ptr) {
22907         LDKUserConfig this_ptr_conv;
22908         this_ptr_conv.inner = untag_ptr(this_ptr);
22909         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22911         this_ptr_conv.is_owned = false;
22912         LDKChannelConfig ret_var = UserConfig_get_channel_config(&this_ptr_conv);
22913         uint64_t ret_ref = 0;
22914         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22915         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22916         return ret_ref;
22917 }
22918
22919 void  __attribute__((export_name("TS_UserConfig_set_channel_config"))) TS_UserConfig_set_channel_config(uint64_t this_ptr, uint64_t val) {
22920         LDKUserConfig this_ptr_conv;
22921         this_ptr_conv.inner = untag_ptr(this_ptr);
22922         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22924         this_ptr_conv.is_owned = false;
22925         LDKChannelConfig val_conv;
22926         val_conv.inner = untag_ptr(val);
22927         val_conv.is_owned = ptr_is_owned(val);
22928         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
22929         val_conv = ChannelConfig_clone(&val_conv);
22930         UserConfig_set_channel_config(&this_ptr_conv, val_conv);
22931 }
22932
22933 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_forwards_to_priv_channels"))) TS_UserConfig_get_accept_forwards_to_priv_channels(uint64_t this_ptr) {
22934         LDKUserConfig this_ptr_conv;
22935         this_ptr_conv.inner = untag_ptr(this_ptr);
22936         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22938         this_ptr_conv.is_owned = false;
22939         jboolean ret_conv = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
22940         return ret_conv;
22941 }
22942
22943 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) {
22944         LDKUserConfig this_ptr_conv;
22945         this_ptr_conv.inner = untag_ptr(this_ptr);
22946         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22948         this_ptr_conv.is_owned = false;
22949         UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
22950 }
22951
22952 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_inbound_channels"))) TS_UserConfig_get_accept_inbound_channels(uint64_t this_ptr) {
22953         LDKUserConfig this_ptr_conv;
22954         this_ptr_conv.inner = untag_ptr(this_ptr);
22955         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22957         this_ptr_conv.is_owned = false;
22958         jboolean ret_conv = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
22959         return ret_conv;
22960 }
22961
22962 void  __attribute__((export_name("TS_UserConfig_set_accept_inbound_channels"))) TS_UserConfig_set_accept_inbound_channels(uint64_t this_ptr, jboolean val) {
22963         LDKUserConfig this_ptr_conv;
22964         this_ptr_conv.inner = untag_ptr(this_ptr);
22965         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22967         this_ptr_conv.is_owned = false;
22968         UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
22969 }
22970
22971 jboolean  __attribute__((export_name("TS_UserConfig_get_manually_accept_inbound_channels"))) TS_UserConfig_get_manually_accept_inbound_channels(uint64_t this_ptr) {
22972         LDKUserConfig this_ptr_conv;
22973         this_ptr_conv.inner = untag_ptr(this_ptr);
22974         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22976         this_ptr_conv.is_owned = false;
22977         jboolean ret_conv = UserConfig_get_manually_accept_inbound_channels(&this_ptr_conv);
22978         return ret_conv;
22979 }
22980
22981 void  __attribute__((export_name("TS_UserConfig_set_manually_accept_inbound_channels"))) TS_UserConfig_set_manually_accept_inbound_channels(uint64_t this_ptr, jboolean val) {
22982         LDKUserConfig this_ptr_conv;
22983         this_ptr_conv.inner = untag_ptr(this_ptr);
22984         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22986         this_ptr_conv.is_owned = false;
22987         UserConfig_set_manually_accept_inbound_channels(&this_ptr_conv, val);
22988 }
22989
22990 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) {
22991         LDKChannelHandshakeConfig channel_handshake_config_arg_conv;
22992         channel_handshake_config_arg_conv.inner = untag_ptr(channel_handshake_config_arg);
22993         channel_handshake_config_arg_conv.is_owned = ptr_is_owned(channel_handshake_config_arg);
22994         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_config_arg_conv);
22995         channel_handshake_config_arg_conv = ChannelHandshakeConfig_clone(&channel_handshake_config_arg_conv);
22996         LDKChannelHandshakeLimits channel_handshake_limits_arg_conv;
22997         channel_handshake_limits_arg_conv.inner = untag_ptr(channel_handshake_limits_arg);
22998         channel_handshake_limits_arg_conv.is_owned = ptr_is_owned(channel_handshake_limits_arg);
22999         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_limits_arg_conv);
23000         channel_handshake_limits_arg_conv = ChannelHandshakeLimits_clone(&channel_handshake_limits_arg_conv);
23001         LDKChannelConfig channel_config_arg_conv;
23002         channel_config_arg_conv.inner = untag_ptr(channel_config_arg);
23003         channel_config_arg_conv.is_owned = ptr_is_owned(channel_config_arg);
23004         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_config_arg_conv);
23005         channel_config_arg_conv = ChannelConfig_clone(&channel_config_arg_conv);
23006         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);
23007         uint64_t ret_ref = 0;
23008         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23009         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23010         return ret_ref;
23011 }
23012
23013 static inline uint64_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
23014         LDKUserConfig ret_var = UserConfig_clone(arg);
23015         uint64_t ret_ref = 0;
23016         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23017         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23018         return ret_ref;
23019 }
23020 int64_t  __attribute__((export_name("TS_UserConfig_clone_ptr"))) TS_UserConfig_clone_ptr(uint64_t arg) {
23021         LDKUserConfig arg_conv;
23022         arg_conv.inner = untag_ptr(arg);
23023         arg_conv.is_owned = ptr_is_owned(arg);
23024         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23025         arg_conv.is_owned = false;
23026         int64_t ret_conv = UserConfig_clone_ptr(&arg_conv);
23027         return ret_conv;
23028 }
23029
23030 uint64_t  __attribute__((export_name("TS_UserConfig_clone"))) TS_UserConfig_clone(uint64_t orig) {
23031         LDKUserConfig orig_conv;
23032         orig_conv.inner = untag_ptr(orig);
23033         orig_conv.is_owned = ptr_is_owned(orig);
23034         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23035         orig_conv.is_owned = false;
23036         LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
23037         uint64_t ret_ref = 0;
23038         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23039         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23040         return ret_ref;
23041 }
23042
23043 uint64_t  __attribute__((export_name("TS_UserConfig_default"))) TS_UserConfig_default() {
23044         LDKUserConfig ret_var = UserConfig_default();
23045         uint64_t ret_ref = 0;
23046         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23047         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23048         return ret_ref;
23049 }
23050
23051 void  __attribute__((export_name("TS_BestBlock_free"))) TS_BestBlock_free(uint64_t this_obj) {
23052         LDKBestBlock this_obj_conv;
23053         this_obj_conv.inner = untag_ptr(this_obj);
23054         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23056         BestBlock_free(this_obj_conv);
23057 }
23058
23059 static inline uint64_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
23060         LDKBestBlock ret_var = BestBlock_clone(arg);
23061         uint64_t ret_ref = 0;
23062         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23063         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23064         return ret_ref;
23065 }
23066 int64_t  __attribute__((export_name("TS_BestBlock_clone_ptr"))) TS_BestBlock_clone_ptr(uint64_t arg) {
23067         LDKBestBlock arg_conv;
23068         arg_conv.inner = untag_ptr(arg);
23069         arg_conv.is_owned = ptr_is_owned(arg);
23070         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23071         arg_conv.is_owned = false;
23072         int64_t ret_conv = BestBlock_clone_ptr(&arg_conv);
23073         return ret_conv;
23074 }
23075
23076 uint64_t  __attribute__((export_name("TS_BestBlock_clone"))) TS_BestBlock_clone(uint64_t orig) {
23077         LDKBestBlock orig_conv;
23078         orig_conv.inner = untag_ptr(orig);
23079         orig_conv.is_owned = ptr_is_owned(orig);
23080         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23081         orig_conv.is_owned = false;
23082         LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
23083         uint64_t ret_ref = 0;
23084         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23085         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23086         return ret_ref;
23087 }
23088
23089 uint64_t  __attribute__((export_name("TS_BestBlock_from_genesis"))) TS_BestBlock_from_genesis(uint32_t network) {
23090         LDKNetwork network_conv = LDKNetwork_from_js(network);
23091         LDKBestBlock ret_var = BestBlock_from_genesis(network_conv);
23092         uint64_t ret_ref = 0;
23093         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23094         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23095         return ret_ref;
23096 }
23097
23098 uint64_t  __attribute__((export_name("TS_BestBlock_new"))) TS_BestBlock_new(int8_tArray block_hash, int32_t height) {
23099         LDKThirtyTwoBytes block_hash_ref;
23100         CHECK(block_hash->arr_len == 32);
23101         memcpy(block_hash_ref.data, block_hash->elems, 32); FREE(block_hash);
23102         LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
23103         uint64_t ret_ref = 0;
23104         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23105         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23106         return ret_ref;
23107 }
23108
23109 int8_tArray  __attribute__((export_name("TS_BestBlock_block_hash"))) TS_BestBlock_block_hash(uint64_t this_arg) {
23110         LDKBestBlock this_arg_conv;
23111         this_arg_conv.inner = untag_ptr(this_arg);
23112         this_arg_conv.is_owned = ptr_is_owned(this_arg);
23113         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23114         this_arg_conv.is_owned = false;
23115         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
23116         memcpy(ret_arr->elems, BestBlock_block_hash(&this_arg_conv).data, 32);
23117         return ret_arr;
23118 }
23119
23120 int32_t  __attribute__((export_name("TS_BestBlock_height"))) TS_BestBlock_height(uint64_t this_arg) {
23121         LDKBestBlock this_arg_conv;
23122         this_arg_conv.inner = untag_ptr(this_arg);
23123         this_arg_conv.is_owned = ptr_is_owned(this_arg);
23124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23125         this_arg_conv.is_owned = false;
23126         int32_t ret_conv = BestBlock_height(&this_arg_conv);
23127         return ret_conv;
23128 }
23129
23130 uint32_t  __attribute__((export_name("TS_AccessError_clone"))) TS_AccessError_clone(uint64_t orig) {
23131         LDKAccessError* orig_conv = (LDKAccessError*)untag_ptr(orig);
23132         uint32_t ret_conv = LDKAccessError_to_js(AccessError_clone(orig_conv));
23133         return ret_conv;
23134 }
23135
23136 uint32_t  __attribute__((export_name("TS_AccessError_unknown_chain"))) TS_AccessError_unknown_chain() {
23137         uint32_t ret_conv = LDKAccessError_to_js(AccessError_unknown_chain());
23138         return ret_conv;
23139 }
23140
23141 uint32_t  __attribute__((export_name("TS_AccessError_unknown_tx"))) TS_AccessError_unknown_tx() {
23142         uint32_t ret_conv = LDKAccessError_to_js(AccessError_unknown_tx());
23143         return ret_conv;
23144 }
23145
23146 void  __attribute__((export_name("TS_Access_free"))) TS_Access_free(uint64_t this_ptr) {
23147         if (!ptr_is_owned(this_ptr)) return;
23148         void* this_ptr_ptr = untag_ptr(this_ptr);
23149         CHECK_ACCESS(this_ptr_ptr);
23150         LDKAccess this_ptr_conv = *(LDKAccess*)(this_ptr_ptr);
23151         FREE(untag_ptr(this_ptr));
23152         Access_free(this_ptr_conv);
23153 }
23154
23155 void  __attribute__((export_name("TS_Listen_free"))) TS_Listen_free(uint64_t this_ptr) {
23156         if (!ptr_is_owned(this_ptr)) return;
23157         void* this_ptr_ptr = untag_ptr(this_ptr);
23158         CHECK_ACCESS(this_ptr_ptr);
23159         LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
23160         FREE(untag_ptr(this_ptr));
23161         Listen_free(this_ptr_conv);
23162 }
23163
23164 void  __attribute__((export_name("TS_Confirm_free"))) TS_Confirm_free(uint64_t this_ptr) {
23165         if (!ptr_is_owned(this_ptr)) return;
23166         void* this_ptr_ptr = untag_ptr(this_ptr);
23167         CHECK_ACCESS(this_ptr_ptr);
23168         LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
23169         FREE(untag_ptr(this_ptr));
23170         Confirm_free(this_ptr_conv);
23171 }
23172
23173 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateErr_clone"))) TS_ChannelMonitorUpdateErr_clone(uint64_t orig) {
23174         LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)untag_ptr(orig);
23175         uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_clone(orig_conv));
23176         return ret_conv;
23177 }
23178
23179 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateErr_temporary_failure"))) TS_ChannelMonitorUpdateErr_temporary_failure() {
23180         uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_temporary_failure());
23181         return ret_conv;
23182 }
23183
23184 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateErr_permanent_failure"))) TS_ChannelMonitorUpdateErr_permanent_failure() {
23185         uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_permanent_failure());
23186         return ret_conv;
23187 }
23188
23189 void  __attribute__((export_name("TS_Watch_free"))) TS_Watch_free(uint64_t this_ptr) {
23190         if (!ptr_is_owned(this_ptr)) return;
23191         void* this_ptr_ptr = untag_ptr(this_ptr);
23192         CHECK_ACCESS(this_ptr_ptr);
23193         LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
23194         FREE(untag_ptr(this_ptr));
23195         Watch_free(this_ptr_conv);
23196 }
23197
23198 void  __attribute__((export_name("TS_Filter_free"))) TS_Filter_free(uint64_t this_ptr) {
23199         if (!ptr_is_owned(this_ptr)) return;
23200         void* this_ptr_ptr = untag_ptr(this_ptr);
23201         CHECK_ACCESS(this_ptr_ptr);
23202         LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
23203         FREE(untag_ptr(this_ptr));
23204         Filter_free(this_ptr_conv);
23205 }
23206
23207 void  __attribute__((export_name("TS_WatchedOutput_free"))) TS_WatchedOutput_free(uint64_t this_obj) {
23208         LDKWatchedOutput this_obj_conv;
23209         this_obj_conv.inner = untag_ptr(this_obj);
23210         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23212         WatchedOutput_free(this_obj_conv);
23213 }
23214
23215 int8_tArray  __attribute__((export_name("TS_WatchedOutput_get_block_hash"))) TS_WatchedOutput_get_block_hash(uint64_t this_ptr) {
23216         LDKWatchedOutput this_ptr_conv;
23217         this_ptr_conv.inner = untag_ptr(this_ptr);
23218         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23220         this_ptr_conv.is_owned = false;
23221         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
23222         memcpy(ret_arr->elems, WatchedOutput_get_block_hash(&this_ptr_conv).data, 32);
23223         return ret_arr;
23224 }
23225
23226 void  __attribute__((export_name("TS_WatchedOutput_set_block_hash"))) TS_WatchedOutput_set_block_hash(uint64_t this_ptr, int8_tArray val) {
23227         LDKWatchedOutput this_ptr_conv;
23228         this_ptr_conv.inner = untag_ptr(this_ptr);
23229         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23231         this_ptr_conv.is_owned = false;
23232         LDKThirtyTwoBytes val_ref;
23233         CHECK(val->arr_len == 32);
23234         memcpy(val_ref.data, val->elems, 32); FREE(val);
23235         WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
23236 }
23237
23238 uint64_t  __attribute__((export_name("TS_WatchedOutput_get_outpoint"))) TS_WatchedOutput_get_outpoint(uint64_t this_ptr) {
23239         LDKWatchedOutput this_ptr_conv;
23240         this_ptr_conv.inner = untag_ptr(this_ptr);
23241         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23243         this_ptr_conv.is_owned = false;
23244         LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
23245         uint64_t ret_ref = 0;
23246         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23247         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23248         return ret_ref;
23249 }
23250
23251 void  __attribute__((export_name("TS_WatchedOutput_set_outpoint"))) TS_WatchedOutput_set_outpoint(uint64_t this_ptr, uint64_t val) {
23252         LDKWatchedOutput this_ptr_conv;
23253         this_ptr_conv.inner = untag_ptr(this_ptr);
23254         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23256         this_ptr_conv.is_owned = false;
23257         LDKOutPoint val_conv;
23258         val_conv.inner = untag_ptr(val);
23259         val_conv.is_owned = ptr_is_owned(val);
23260         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
23261         val_conv = OutPoint_clone(&val_conv);
23262         WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
23263 }
23264
23265 int8_tArray  __attribute__((export_name("TS_WatchedOutput_get_script_pubkey"))) TS_WatchedOutput_get_script_pubkey(uint64_t this_ptr) {
23266         LDKWatchedOutput this_ptr_conv;
23267         this_ptr_conv.inner = untag_ptr(this_ptr);
23268         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23270         this_ptr_conv.is_owned = false;
23271         LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
23272         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
23273         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
23274         return ret_arr;
23275 }
23276
23277 void  __attribute__((export_name("TS_WatchedOutput_set_script_pubkey"))) TS_WatchedOutput_set_script_pubkey(uint64_t this_ptr, int8_tArray val) {
23278         LDKWatchedOutput this_ptr_conv;
23279         this_ptr_conv.inner = untag_ptr(this_ptr);
23280         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23282         this_ptr_conv.is_owned = false;
23283         LDKCVec_u8Z val_ref;
23284         val_ref.datalen = val->arr_len;
23285         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
23286         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
23287         WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
23288 }
23289
23290 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) {
23291         LDKThirtyTwoBytes block_hash_arg_ref;
23292         CHECK(block_hash_arg->arr_len == 32);
23293         memcpy(block_hash_arg_ref.data, block_hash_arg->elems, 32); FREE(block_hash_arg);
23294         LDKOutPoint outpoint_arg_conv;
23295         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
23296         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
23297         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
23298         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
23299         LDKCVec_u8Z script_pubkey_arg_ref;
23300         script_pubkey_arg_ref.datalen = script_pubkey_arg->arr_len;
23301         script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
23302         memcpy(script_pubkey_arg_ref.data, script_pubkey_arg->elems, script_pubkey_arg_ref.datalen); FREE(script_pubkey_arg);
23303         LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
23304         uint64_t ret_ref = 0;
23305         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23306         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23307         return ret_ref;
23308 }
23309
23310 static inline uint64_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
23311         LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
23312         uint64_t ret_ref = 0;
23313         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23314         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23315         return ret_ref;
23316 }
23317 int64_t  __attribute__((export_name("TS_WatchedOutput_clone_ptr"))) TS_WatchedOutput_clone_ptr(uint64_t arg) {
23318         LDKWatchedOutput arg_conv;
23319         arg_conv.inner = untag_ptr(arg);
23320         arg_conv.is_owned = ptr_is_owned(arg);
23321         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23322         arg_conv.is_owned = false;
23323         int64_t ret_conv = WatchedOutput_clone_ptr(&arg_conv);
23324         return ret_conv;
23325 }
23326
23327 uint64_t  __attribute__((export_name("TS_WatchedOutput_clone"))) TS_WatchedOutput_clone(uint64_t orig) {
23328         LDKWatchedOutput orig_conv;
23329         orig_conv.inner = untag_ptr(orig);
23330         orig_conv.is_owned = ptr_is_owned(orig);
23331         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23332         orig_conv.is_owned = false;
23333         LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
23334         uint64_t ret_ref = 0;
23335         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23336         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23337         return ret_ref;
23338 }
23339
23340 int64_t  __attribute__((export_name("TS_WatchedOutput_hash"))) TS_WatchedOutput_hash(uint64_t o) {
23341         LDKWatchedOutput o_conv;
23342         o_conv.inner = untag_ptr(o);
23343         o_conv.is_owned = ptr_is_owned(o);
23344         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23345         o_conv.is_owned = false;
23346         int64_t ret_conv = WatchedOutput_hash(&o_conv);
23347         return ret_conv;
23348 }
23349
23350 void  __attribute__((export_name("TS_BroadcasterInterface_free"))) TS_BroadcasterInterface_free(uint64_t this_ptr) {
23351         if (!ptr_is_owned(this_ptr)) return;
23352         void* this_ptr_ptr = untag_ptr(this_ptr);
23353         CHECK_ACCESS(this_ptr_ptr);
23354         LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
23355         FREE(untag_ptr(this_ptr));
23356         BroadcasterInterface_free(this_ptr_conv);
23357 }
23358
23359 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_clone"))) TS_ConfirmationTarget_clone(uint64_t orig) {
23360         LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)untag_ptr(orig);
23361         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_clone(orig_conv));
23362         return ret_conv;
23363 }
23364
23365 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_background"))) TS_ConfirmationTarget_background() {
23366         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_background());
23367         return ret_conv;
23368 }
23369
23370 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_normal"))) TS_ConfirmationTarget_normal() {
23371         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_normal());
23372         return ret_conv;
23373 }
23374
23375 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_high_priority"))) TS_ConfirmationTarget_high_priority() {
23376         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_high_priority());
23377         return ret_conv;
23378 }
23379
23380 jboolean  __attribute__((export_name("TS_ConfirmationTarget_eq"))) TS_ConfirmationTarget_eq(uint64_t a, uint64_t b) {
23381         LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)untag_ptr(a);
23382         LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)untag_ptr(b);
23383         jboolean ret_conv = ConfirmationTarget_eq(a_conv, b_conv);
23384         return ret_conv;
23385 }
23386
23387 void  __attribute__((export_name("TS_FeeEstimator_free"))) TS_FeeEstimator_free(uint64_t this_ptr) {
23388         if (!ptr_is_owned(this_ptr)) return;
23389         void* this_ptr_ptr = untag_ptr(this_ptr);
23390         CHECK_ACCESS(this_ptr_ptr);
23391         LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
23392         FREE(untag_ptr(this_ptr));
23393         FeeEstimator_free(this_ptr_conv);
23394 }
23395
23396 void  __attribute__((export_name("TS_MonitorUpdateId_free"))) TS_MonitorUpdateId_free(uint64_t this_obj) {
23397         LDKMonitorUpdateId this_obj_conv;
23398         this_obj_conv.inner = untag_ptr(this_obj);
23399         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23401         MonitorUpdateId_free(this_obj_conv);
23402 }
23403
23404 static inline uint64_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
23405         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
23406         uint64_t ret_ref = 0;
23407         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23408         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23409         return ret_ref;
23410 }
23411 int64_t  __attribute__((export_name("TS_MonitorUpdateId_clone_ptr"))) TS_MonitorUpdateId_clone_ptr(uint64_t arg) {
23412         LDKMonitorUpdateId arg_conv;
23413         arg_conv.inner = untag_ptr(arg);
23414         arg_conv.is_owned = ptr_is_owned(arg);
23415         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23416         arg_conv.is_owned = false;
23417         int64_t ret_conv = MonitorUpdateId_clone_ptr(&arg_conv);
23418         return ret_conv;
23419 }
23420
23421 uint64_t  __attribute__((export_name("TS_MonitorUpdateId_clone"))) TS_MonitorUpdateId_clone(uint64_t orig) {
23422         LDKMonitorUpdateId orig_conv;
23423         orig_conv.inner = untag_ptr(orig);
23424         orig_conv.is_owned = ptr_is_owned(orig);
23425         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23426         orig_conv.is_owned = false;
23427         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
23428         uint64_t ret_ref = 0;
23429         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23430         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23431         return ret_ref;
23432 }
23433
23434 int64_t  __attribute__((export_name("TS_MonitorUpdateId_hash"))) TS_MonitorUpdateId_hash(uint64_t o) {
23435         LDKMonitorUpdateId o_conv;
23436         o_conv.inner = untag_ptr(o);
23437         o_conv.is_owned = ptr_is_owned(o);
23438         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23439         o_conv.is_owned = false;
23440         int64_t ret_conv = MonitorUpdateId_hash(&o_conv);
23441         return ret_conv;
23442 }
23443
23444 jboolean  __attribute__((export_name("TS_MonitorUpdateId_eq"))) TS_MonitorUpdateId_eq(uint64_t a, uint64_t b) {
23445         LDKMonitorUpdateId a_conv;
23446         a_conv.inner = untag_ptr(a);
23447         a_conv.is_owned = ptr_is_owned(a);
23448         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
23449         a_conv.is_owned = false;
23450         LDKMonitorUpdateId b_conv;
23451         b_conv.inner = untag_ptr(b);
23452         b_conv.is_owned = ptr_is_owned(b);
23453         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
23454         b_conv.is_owned = false;
23455         jboolean ret_conv = MonitorUpdateId_eq(&a_conv, &b_conv);
23456         return ret_conv;
23457 }
23458
23459 void  __attribute__((export_name("TS_Persist_free"))) TS_Persist_free(uint64_t this_ptr) {
23460         if (!ptr_is_owned(this_ptr)) return;
23461         void* this_ptr_ptr = untag_ptr(this_ptr);
23462         CHECK_ACCESS(this_ptr_ptr);
23463         LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
23464         FREE(untag_ptr(this_ptr));
23465         Persist_free(this_ptr_conv);
23466 }
23467
23468 void  __attribute__((export_name("TS_LockedChannelMonitor_free"))) TS_LockedChannelMonitor_free(uint64_t this_obj) {
23469         LDKLockedChannelMonitor this_obj_conv;
23470         this_obj_conv.inner = untag_ptr(this_obj);
23471         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23473         LockedChannelMonitor_free(this_obj_conv);
23474 }
23475
23476 void  __attribute__((export_name("TS_ChainMonitor_free"))) TS_ChainMonitor_free(uint64_t this_obj) {
23477         LDKChainMonitor this_obj_conv;
23478         this_obj_conv.inner = untag_ptr(this_obj);
23479         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23481         ChainMonitor_free(this_obj_conv);
23482 }
23483
23484 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) {
23485         void* chain_source_ptr = untag_ptr(chain_source);
23486         CHECK_ACCESS(chain_source_ptr);
23487         LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
23488         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
23489         if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
23490                 // Manually implement clone for Java trait instances
23491                 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
23492                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23493                         LDKFilter_JCalls_cloned(&chain_source_conv.some);
23494                 }
23495         }
23496         void* broadcaster_ptr = untag_ptr(broadcaster);
23497         CHECK_ACCESS(broadcaster_ptr);
23498         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
23499         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
23500                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23501                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
23502         }
23503         void* logger_ptr = untag_ptr(logger);
23504         CHECK_ACCESS(logger_ptr);
23505         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
23506         if (logger_conv.free == LDKLogger_JCalls_free) {
23507                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23508                 LDKLogger_JCalls_cloned(&logger_conv);
23509         }
23510         void* feeest_ptr = untag_ptr(feeest);
23511         CHECK_ACCESS(feeest_ptr);
23512         LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
23513         if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
23514                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23515                 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
23516         }
23517         void* persister_ptr = untag_ptr(persister);
23518         CHECK_ACCESS(persister_ptr);
23519         LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
23520         if (persister_conv.free == LDKPersist_JCalls_free) {
23521                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23522                 LDKPersist_JCalls_cloned(&persister_conv);
23523         }
23524         LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
23525         uint64_t ret_ref = 0;
23526         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23527         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23528         return ret_ref;
23529 }
23530
23531 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_get_claimable_balances"))) TS_ChainMonitor_get_claimable_balances(uint64_t this_arg, uint64_tArray ignored_channels) {
23532         LDKChainMonitor this_arg_conv;
23533         this_arg_conv.inner = untag_ptr(this_arg);
23534         this_arg_conv.is_owned = ptr_is_owned(this_arg);
23535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23536         this_arg_conv.is_owned = false;
23537         LDKCVec_ChannelDetailsZ ignored_channels_constr;
23538         ignored_channels_constr.datalen = ignored_channels->arr_len;
23539         if (ignored_channels_constr.datalen > 0)
23540                 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
23541         else
23542                 ignored_channels_constr.data = NULL;
23543         uint64_t* ignored_channels_vals = ignored_channels->elems;
23544         for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
23545                 uint64_t ignored_channels_conv_16 = ignored_channels_vals[q];
23546                 LDKChannelDetails ignored_channels_conv_16_conv;
23547                 ignored_channels_conv_16_conv.inner = untag_ptr(ignored_channels_conv_16);
23548                 ignored_channels_conv_16_conv.is_owned = ptr_is_owned(ignored_channels_conv_16);
23549                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
23550                 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
23551                 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
23552         }
23553         FREE(ignored_channels);
23554         LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
23555         uint64_tArray ret_arr = NULL;
23556         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
23557         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
23558         for (size_t j = 0; j < ret_var.datalen; j++) {
23559                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
23560                 *ret_conv_9_copy = ret_var.data[j];
23561                 uint64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
23562                 ret_arr_ptr[j] = ret_conv_9_ref;
23563         }
23564         
23565         FREE(ret_var.data);
23566         return ret_arr;
23567 }
23568
23569 uint64_t  __attribute__((export_name("TS_ChainMonitor_get_monitor"))) TS_ChainMonitor_get_monitor(uint64_t this_arg, uint64_t funding_txo) {
23570         LDKChainMonitor this_arg_conv;
23571         this_arg_conv.inner = untag_ptr(this_arg);
23572         this_arg_conv.is_owned = ptr_is_owned(this_arg);
23573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23574         this_arg_conv.is_owned = false;
23575         LDKOutPoint funding_txo_conv;
23576         funding_txo_conv.inner = untag_ptr(funding_txo);
23577         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
23578         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
23579         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
23580         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
23581         *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
23582         return tag_ptr(ret_conv, true);
23583 }
23584
23585 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_list_monitors"))) TS_ChainMonitor_list_monitors(uint64_t this_arg) {
23586         LDKChainMonitor this_arg_conv;
23587         this_arg_conv.inner = untag_ptr(this_arg);
23588         this_arg_conv.is_owned = ptr_is_owned(this_arg);
23589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23590         this_arg_conv.is_owned = false;
23591         LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
23592         uint64_tArray ret_arr = NULL;
23593         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
23594         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
23595         for (size_t k = 0; k < ret_var.datalen; k++) {
23596                 LDKOutPoint ret_conv_10_var = ret_var.data[k];
23597                 uint64_t ret_conv_10_ref = 0;
23598                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
23599                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
23600                 ret_arr_ptr[k] = ret_conv_10_ref;
23601         }
23602         
23603         FREE(ret_var.data);
23604         return ret_arr;
23605 }
23606
23607 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) {
23608         LDKChainMonitor this_arg_conv;
23609         this_arg_conv.inner = untag_ptr(this_arg);
23610         this_arg_conv.is_owned = ptr_is_owned(this_arg);
23611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23612         this_arg_conv.is_owned = false;
23613         LDKOutPoint funding_txo_conv;
23614         funding_txo_conv.inner = untag_ptr(funding_txo);
23615         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
23616         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
23617         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
23618         LDKMonitorUpdateId completed_update_id_conv;
23619         completed_update_id_conv.inner = untag_ptr(completed_update_id);
23620         completed_update_id_conv.is_owned = ptr_is_owned(completed_update_id);
23621         CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
23622         completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
23623         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
23624         *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
23625         return tag_ptr(ret_conv, true);
23626 }
23627
23628 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Listen"))) TS_ChainMonitor_as_Listen(uint64_t this_arg) {
23629         LDKChainMonitor this_arg_conv;
23630         this_arg_conv.inner = untag_ptr(this_arg);
23631         this_arg_conv.is_owned = ptr_is_owned(this_arg);
23632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23633         this_arg_conv.is_owned = false;
23634         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
23635         *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
23636         return tag_ptr(ret_ret, true);
23637 }
23638
23639 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Confirm"))) TS_ChainMonitor_as_Confirm(uint64_t this_arg) {
23640         LDKChainMonitor this_arg_conv;
23641         this_arg_conv.inner = untag_ptr(this_arg);
23642         this_arg_conv.is_owned = ptr_is_owned(this_arg);
23643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23644         this_arg_conv.is_owned = false;
23645         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
23646         *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
23647         return tag_ptr(ret_ret, true);
23648 }
23649
23650 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Watch"))) TS_ChainMonitor_as_Watch(uint64_t this_arg) {
23651         LDKChainMonitor this_arg_conv;
23652         this_arg_conv.inner = untag_ptr(this_arg);
23653         this_arg_conv.is_owned = ptr_is_owned(this_arg);
23654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23655         this_arg_conv.is_owned = false;
23656         LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
23657         *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
23658         return tag_ptr(ret_ret, true);
23659 }
23660
23661 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_EventsProvider"))) TS_ChainMonitor_as_EventsProvider(uint64_t this_arg) {
23662         LDKChainMonitor this_arg_conv;
23663         this_arg_conv.inner = untag_ptr(this_arg);
23664         this_arg_conv.is_owned = ptr_is_owned(this_arg);
23665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23666         this_arg_conv.is_owned = false;
23667         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
23668         *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
23669         return tag_ptr(ret_ret, true);
23670 }
23671
23672 void  __attribute__((export_name("TS_ChannelMonitorUpdate_free"))) TS_ChannelMonitorUpdate_free(uint64_t this_obj) {
23673         LDKChannelMonitorUpdate this_obj_conv;
23674         this_obj_conv.inner = untag_ptr(this_obj);
23675         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23677         ChannelMonitorUpdate_free(this_obj_conv);
23678 }
23679
23680 int64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_get_update_id"))) TS_ChannelMonitorUpdate_get_update_id(uint64_t this_ptr) {
23681         LDKChannelMonitorUpdate this_ptr_conv;
23682         this_ptr_conv.inner = untag_ptr(this_ptr);
23683         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23685         this_ptr_conv.is_owned = false;
23686         int64_t ret_conv = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
23687         return ret_conv;
23688 }
23689
23690 void  __attribute__((export_name("TS_ChannelMonitorUpdate_set_update_id"))) TS_ChannelMonitorUpdate_set_update_id(uint64_t this_ptr, int64_t val) {
23691         LDKChannelMonitorUpdate this_ptr_conv;
23692         this_ptr_conv.inner = untag_ptr(this_ptr);
23693         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23695         this_ptr_conv.is_owned = false;
23696         ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
23697 }
23698
23699 static inline uint64_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
23700         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
23701         uint64_t ret_ref = 0;
23702         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23703         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23704         return ret_ref;
23705 }
23706 int64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_clone_ptr"))) TS_ChannelMonitorUpdate_clone_ptr(uint64_t arg) {
23707         LDKChannelMonitorUpdate arg_conv;
23708         arg_conv.inner = untag_ptr(arg);
23709         arg_conv.is_owned = ptr_is_owned(arg);
23710         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23711         arg_conv.is_owned = false;
23712         int64_t ret_conv = ChannelMonitorUpdate_clone_ptr(&arg_conv);
23713         return ret_conv;
23714 }
23715
23716 uint64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_clone"))) TS_ChannelMonitorUpdate_clone(uint64_t orig) {
23717         LDKChannelMonitorUpdate orig_conv;
23718         orig_conv.inner = untag_ptr(orig);
23719         orig_conv.is_owned = ptr_is_owned(orig);
23720         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23721         orig_conv.is_owned = false;
23722         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
23723         uint64_t ret_ref = 0;
23724         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23725         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23726         return ret_ref;
23727 }
23728
23729 int8_tArray  __attribute__((export_name("TS_ChannelMonitorUpdate_write"))) TS_ChannelMonitorUpdate_write(uint64_t obj) {
23730         LDKChannelMonitorUpdate obj_conv;
23731         obj_conv.inner = untag_ptr(obj);
23732         obj_conv.is_owned = ptr_is_owned(obj);
23733         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
23734         obj_conv.is_owned = false;
23735         LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
23736         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
23737         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
23738         CVec_u8Z_free(ret_var);
23739         return ret_arr;
23740 }
23741
23742 uint64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_read"))) TS_ChannelMonitorUpdate_read(int8_tArray ser) {
23743         LDKu8slice ser_ref;
23744         ser_ref.datalen = ser->arr_len;
23745         ser_ref.data = ser->elems;
23746         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
23747         *ret_conv = ChannelMonitorUpdate_read(ser_ref);
23748         FREE(ser);
23749         return tag_ptr(ret_conv, true);
23750 }
23751
23752 void  __attribute__((export_name("TS_MonitorEvent_free"))) TS_MonitorEvent_free(uint64_t this_ptr) {
23753         if (!ptr_is_owned(this_ptr)) return;
23754         void* this_ptr_ptr = untag_ptr(this_ptr);
23755         CHECK_ACCESS(this_ptr_ptr);
23756         LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
23757         FREE(untag_ptr(this_ptr));
23758         MonitorEvent_free(this_ptr_conv);
23759 }
23760
23761 static inline uint64_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
23762         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
23763         *ret_copy = MonitorEvent_clone(arg);
23764         uint64_t ret_ref = tag_ptr(ret_copy, true);
23765         return ret_ref;
23766 }
23767 int64_t  __attribute__((export_name("TS_MonitorEvent_clone_ptr"))) TS_MonitorEvent_clone_ptr(uint64_t arg) {
23768         LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)untag_ptr(arg);
23769         int64_t ret_conv = MonitorEvent_clone_ptr(arg_conv);
23770         return ret_conv;
23771 }
23772
23773 uint64_t  __attribute__((export_name("TS_MonitorEvent_clone"))) TS_MonitorEvent_clone(uint64_t orig) {
23774         LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)untag_ptr(orig);
23775         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
23776         *ret_copy = MonitorEvent_clone(orig_conv);
23777         uint64_t ret_ref = tag_ptr(ret_copy, true);
23778         return ret_ref;
23779 }
23780
23781 uint64_t  __attribute__((export_name("TS_MonitorEvent_htlcevent"))) TS_MonitorEvent_htlcevent(uint64_t a) {
23782         LDKHTLCUpdate a_conv;
23783         a_conv.inner = untag_ptr(a);
23784         a_conv.is_owned = ptr_is_owned(a);
23785         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
23786         a_conv = HTLCUpdate_clone(&a_conv);
23787         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
23788         *ret_copy = MonitorEvent_htlcevent(a_conv);
23789         uint64_t ret_ref = tag_ptr(ret_copy, true);
23790         return ret_ref;
23791 }
23792
23793 uint64_t  __attribute__((export_name("TS_MonitorEvent_commitment_tx_confirmed"))) TS_MonitorEvent_commitment_tx_confirmed(uint64_t a) {
23794         LDKOutPoint a_conv;
23795         a_conv.inner = untag_ptr(a);
23796         a_conv.is_owned = ptr_is_owned(a);
23797         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
23798         a_conv = OutPoint_clone(&a_conv);
23799         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
23800         *ret_copy = MonitorEvent_commitment_tx_confirmed(a_conv);
23801         uint64_t ret_ref = tag_ptr(ret_copy, true);
23802         return ret_ref;
23803 }
23804
23805 uint64_t  __attribute__((export_name("TS_MonitorEvent_update_completed"))) TS_MonitorEvent_update_completed(uint64_t funding_txo, int64_t monitor_update_id) {
23806         LDKOutPoint funding_txo_conv;
23807         funding_txo_conv.inner = untag_ptr(funding_txo);
23808         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
23809         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
23810         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
23811         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
23812         *ret_copy = MonitorEvent_update_completed(funding_txo_conv, monitor_update_id);
23813         uint64_t ret_ref = tag_ptr(ret_copy, true);
23814         return ret_ref;
23815 }
23816
23817 uint64_t  __attribute__((export_name("TS_MonitorEvent_update_failed"))) TS_MonitorEvent_update_failed(uint64_t a) {
23818         LDKOutPoint a_conv;
23819         a_conv.inner = untag_ptr(a);
23820         a_conv.is_owned = ptr_is_owned(a);
23821         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
23822         a_conv = OutPoint_clone(&a_conv);
23823         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
23824         *ret_copy = MonitorEvent_update_failed(a_conv);
23825         uint64_t ret_ref = tag_ptr(ret_copy, true);
23826         return ret_ref;
23827 }
23828
23829 int8_tArray  __attribute__((export_name("TS_MonitorEvent_write"))) TS_MonitorEvent_write(uint64_t obj) {
23830         LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)untag_ptr(obj);
23831         LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
23832         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
23833         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
23834         CVec_u8Z_free(ret_var);
23835         return ret_arr;
23836 }
23837
23838 uint64_t  __attribute__((export_name("TS_MonitorEvent_read"))) TS_MonitorEvent_read(int8_tArray ser) {
23839         LDKu8slice ser_ref;
23840         ser_ref.datalen = ser->arr_len;
23841         ser_ref.data = ser->elems;
23842         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
23843         *ret_conv = MonitorEvent_read(ser_ref);
23844         FREE(ser);
23845         return tag_ptr(ret_conv, true);
23846 }
23847
23848 void  __attribute__((export_name("TS_HTLCUpdate_free"))) TS_HTLCUpdate_free(uint64_t this_obj) {
23849         LDKHTLCUpdate this_obj_conv;
23850         this_obj_conv.inner = untag_ptr(this_obj);
23851         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23853         HTLCUpdate_free(this_obj_conv);
23854 }
23855
23856 static inline uint64_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
23857         LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
23858         uint64_t ret_ref = 0;
23859         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23860         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23861         return ret_ref;
23862 }
23863 int64_t  __attribute__((export_name("TS_HTLCUpdate_clone_ptr"))) TS_HTLCUpdate_clone_ptr(uint64_t arg) {
23864         LDKHTLCUpdate arg_conv;
23865         arg_conv.inner = untag_ptr(arg);
23866         arg_conv.is_owned = ptr_is_owned(arg);
23867         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23868         arg_conv.is_owned = false;
23869         int64_t ret_conv = HTLCUpdate_clone_ptr(&arg_conv);
23870         return ret_conv;
23871 }
23872
23873 uint64_t  __attribute__((export_name("TS_HTLCUpdate_clone"))) TS_HTLCUpdate_clone(uint64_t orig) {
23874         LDKHTLCUpdate orig_conv;
23875         orig_conv.inner = untag_ptr(orig);
23876         orig_conv.is_owned = ptr_is_owned(orig);
23877         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23878         orig_conv.is_owned = false;
23879         LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
23880         uint64_t ret_ref = 0;
23881         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23882         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23883         return ret_ref;
23884 }
23885
23886 int8_tArray  __attribute__((export_name("TS_HTLCUpdate_write"))) TS_HTLCUpdate_write(uint64_t obj) {
23887         LDKHTLCUpdate obj_conv;
23888         obj_conv.inner = untag_ptr(obj);
23889         obj_conv.is_owned = ptr_is_owned(obj);
23890         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
23891         obj_conv.is_owned = false;
23892         LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
23893         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
23894         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
23895         CVec_u8Z_free(ret_var);
23896         return ret_arr;
23897 }
23898
23899 uint64_t  __attribute__((export_name("TS_HTLCUpdate_read"))) TS_HTLCUpdate_read(int8_tArray ser) {
23900         LDKu8slice ser_ref;
23901         ser_ref.datalen = ser->arr_len;
23902         ser_ref.data = ser->elems;
23903         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
23904         *ret_conv = HTLCUpdate_read(ser_ref);
23905         FREE(ser);
23906         return tag_ptr(ret_conv, true);
23907 }
23908
23909 void  __attribute__((export_name("TS_Balance_free"))) TS_Balance_free(uint64_t this_ptr) {
23910         if (!ptr_is_owned(this_ptr)) return;
23911         void* this_ptr_ptr = untag_ptr(this_ptr);
23912         CHECK_ACCESS(this_ptr_ptr);
23913         LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
23914         FREE(untag_ptr(this_ptr));
23915         Balance_free(this_ptr_conv);
23916 }
23917
23918 static inline uint64_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
23919         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
23920         *ret_copy = Balance_clone(arg);
23921         uint64_t ret_ref = tag_ptr(ret_copy, true);
23922         return ret_ref;
23923 }
23924 int64_t  __attribute__((export_name("TS_Balance_clone_ptr"))) TS_Balance_clone_ptr(uint64_t arg) {
23925         LDKBalance* arg_conv = (LDKBalance*)untag_ptr(arg);
23926         int64_t ret_conv = Balance_clone_ptr(arg_conv);
23927         return ret_conv;
23928 }
23929
23930 uint64_t  __attribute__((export_name("TS_Balance_clone"))) TS_Balance_clone(uint64_t orig) {
23931         LDKBalance* orig_conv = (LDKBalance*)untag_ptr(orig);
23932         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
23933         *ret_copy = Balance_clone(orig_conv);
23934         uint64_t ret_ref = tag_ptr(ret_copy, true);
23935         return ret_ref;
23936 }
23937
23938 uint64_t  __attribute__((export_name("TS_Balance_claimable_on_channel_close"))) TS_Balance_claimable_on_channel_close(int64_t claimable_amount_satoshis) {
23939         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
23940         *ret_copy = Balance_claimable_on_channel_close(claimable_amount_satoshis);
23941         uint64_t ret_ref = tag_ptr(ret_copy, true);
23942         return ret_ref;
23943 }
23944
23945 uint64_t  __attribute__((export_name("TS_Balance_claimable_awaiting_confirmations"))) TS_Balance_claimable_awaiting_confirmations(int64_t claimable_amount_satoshis, int32_t confirmation_height) {
23946         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
23947         *ret_copy = Balance_claimable_awaiting_confirmations(claimable_amount_satoshis, confirmation_height);
23948         uint64_t ret_ref = tag_ptr(ret_copy, true);
23949         return ret_ref;
23950 }
23951
23952 uint64_t  __attribute__((export_name("TS_Balance_contentious_claimable"))) TS_Balance_contentious_claimable(int64_t claimable_amount_satoshis, int32_t timeout_height) {
23953         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
23954         *ret_copy = Balance_contentious_claimable(claimable_amount_satoshis, timeout_height);
23955         uint64_t ret_ref = tag_ptr(ret_copy, true);
23956         return ret_ref;
23957 }
23958
23959 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) {
23960         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
23961         *ret_copy = Balance_maybe_timeout_claimable_htlc(claimable_amount_satoshis, claimable_height);
23962         uint64_t ret_ref = tag_ptr(ret_copy, true);
23963         return ret_ref;
23964 }
23965
23966 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) {
23967         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
23968         *ret_copy = Balance_maybe_preimage_claimable_htlc(claimable_amount_satoshis, expiry_height);
23969         uint64_t ret_ref = tag_ptr(ret_copy, true);
23970         return ret_ref;
23971 }
23972
23973 uint64_t  __attribute__((export_name("TS_Balance_counterparty_revoked_output_claimable"))) TS_Balance_counterparty_revoked_output_claimable(int64_t claimable_amount_satoshis) {
23974         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
23975         *ret_copy = Balance_counterparty_revoked_output_claimable(claimable_amount_satoshis);
23976         uint64_t ret_ref = tag_ptr(ret_copy, true);
23977         return ret_ref;
23978 }
23979
23980 jboolean  __attribute__((export_name("TS_Balance_eq"))) TS_Balance_eq(uint64_t a, uint64_t b) {
23981         LDKBalance* a_conv = (LDKBalance*)untag_ptr(a);
23982         LDKBalance* b_conv = (LDKBalance*)untag_ptr(b);
23983         jboolean ret_conv = Balance_eq(a_conv, b_conv);
23984         return ret_conv;
23985 }
23986
23987 void  __attribute__((export_name("TS_ChannelMonitor_free"))) TS_ChannelMonitor_free(uint64_t this_obj) {
23988         LDKChannelMonitor this_obj_conv;
23989         this_obj_conv.inner = untag_ptr(this_obj);
23990         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23992         ChannelMonitor_free(this_obj_conv);
23993 }
23994
23995 static inline uint64_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
23996         LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
23997         uint64_t ret_ref = 0;
23998         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23999         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24000         return ret_ref;
24001 }
24002 int64_t  __attribute__((export_name("TS_ChannelMonitor_clone_ptr"))) TS_ChannelMonitor_clone_ptr(uint64_t arg) {
24003         LDKChannelMonitor arg_conv;
24004         arg_conv.inner = untag_ptr(arg);
24005         arg_conv.is_owned = ptr_is_owned(arg);
24006         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24007         arg_conv.is_owned = false;
24008         int64_t ret_conv = ChannelMonitor_clone_ptr(&arg_conv);
24009         return ret_conv;
24010 }
24011
24012 uint64_t  __attribute__((export_name("TS_ChannelMonitor_clone"))) TS_ChannelMonitor_clone(uint64_t orig) {
24013         LDKChannelMonitor orig_conv;
24014         orig_conv.inner = untag_ptr(orig);
24015         orig_conv.is_owned = ptr_is_owned(orig);
24016         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24017         orig_conv.is_owned = false;
24018         LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
24019         uint64_t ret_ref = 0;
24020         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24021         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24022         return ret_ref;
24023 }
24024
24025 int8_tArray  __attribute__((export_name("TS_ChannelMonitor_write"))) TS_ChannelMonitor_write(uint64_t obj) {
24026         LDKChannelMonitor obj_conv;
24027         obj_conv.inner = untag_ptr(obj);
24028         obj_conv.is_owned = ptr_is_owned(obj);
24029         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
24030         obj_conv.is_owned = false;
24031         LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
24032         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
24033         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
24034         CVec_u8Z_free(ret_var);
24035         return ret_arr;
24036 }
24037
24038 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) {
24039         LDKChannelMonitor this_arg_conv;
24040         this_arg_conv.inner = untag_ptr(this_arg);
24041         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24043         this_arg_conv.is_owned = false;
24044         LDKChannelMonitorUpdate updates_conv;
24045         updates_conv.inner = untag_ptr(updates);
24046         updates_conv.is_owned = ptr_is_owned(updates);
24047         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
24048         updates_conv.is_owned = false;
24049         void* broadcaster_ptr = untag_ptr(broadcaster);
24050         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
24051         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
24052         void* fee_estimator_ptr = untag_ptr(fee_estimator);
24053         CHECK_ACCESS(fee_estimator_ptr);
24054         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
24055         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
24056                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24057                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
24058         }
24059         void* logger_ptr = untag_ptr(logger);
24060         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
24061         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
24062         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
24063         *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
24064         return tag_ptr(ret_conv, true);
24065 }
24066
24067 int64_t  __attribute__((export_name("TS_ChannelMonitor_get_latest_update_id"))) TS_ChannelMonitor_get_latest_update_id(uint64_t this_arg) {
24068         LDKChannelMonitor this_arg_conv;
24069         this_arg_conv.inner = untag_ptr(this_arg);
24070         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24071         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24072         this_arg_conv.is_owned = false;
24073         int64_t ret_conv = ChannelMonitor_get_latest_update_id(&this_arg_conv);
24074         return ret_conv;
24075 }
24076
24077 uint64_t  __attribute__((export_name("TS_ChannelMonitor_get_funding_txo"))) TS_ChannelMonitor_get_funding_txo(uint64_t this_arg) {
24078         LDKChannelMonitor this_arg_conv;
24079         this_arg_conv.inner = untag_ptr(this_arg);
24080         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24081         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24082         this_arg_conv.is_owned = false;
24083         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
24084         *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
24085         return tag_ptr(ret_conv, true);
24086 }
24087
24088 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_outputs_to_watch"))) TS_ChannelMonitor_get_outputs_to_watch(uint64_t this_arg) {
24089         LDKChannelMonitor this_arg_conv;
24090         this_arg_conv.inner = untag_ptr(this_arg);
24091         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24093         this_arg_conv.is_owned = false;
24094         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
24095         uint64_tArray ret_arr = NULL;
24096         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
24097         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
24098         for (size_t o = 0; o < ret_var.datalen; o++) {
24099                 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
24100                 *ret_conv_40_conv = ret_var.data[o];
24101                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
24102         }
24103         
24104         FREE(ret_var.data);
24105         return ret_arr;
24106 }
24107
24108 void  __attribute__((export_name("TS_ChannelMonitor_load_outputs_to_watch"))) TS_ChannelMonitor_load_outputs_to_watch(uint64_t this_arg, uint64_t filter) {
24109         LDKChannelMonitor this_arg_conv;
24110         this_arg_conv.inner = untag_ptr(this_arg);
24111         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24113         this_arg_conv.is_owned = false;
24114         void* filter_ptr = untag_ptr(filter);
24115         if (ptr_is_owned(filter)) { CHECK_ACCESS(filter_ptr); }
24116         LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
24117         ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
24118 }
24119
24120 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) {
24121         LDKChannelMonitor this_arg_conv;
24122         this_arg_conv.inner = untag_ptr(this_arg);
24123         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24125         this_arg_conv.is_owned = false;
24126         LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
24127         uint64_tArray ret_arr = NULL;
24128         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
24129         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
24130         for (size_t o = 0; o < ret_var.datalen; o++) {
24131                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
24132                 *ret_conv_14_copy = ret_var.data[o];
24133                 uint64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
24134                 ret_arr_ptr[o] = ret_conv_14_ref;
24135         }
24136         
24137         FREE(ret_var.data);
24138         return ret_arr;
24139 }
24140
24141 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_and_clear_pending_events"))) TS_ChannelMonitor_get_and_clear_pending_events(uint64_t this_arg) {
24142         LDKChannelMonitor this_arg_conv;
24143         this_arg_conv.inner = untag_ptr(this_arg);
24144         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24146         this_arg_conv.is_owned = false;
24147         LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
24148         uint64_tArray ret_arr = NULL;
24149         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
24150         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
24151         for (size_t h = 0; h < ret_var.datalen; h++) {
24152                 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
24153                 *ret_conv_7_copy = ret_var.data[h];
24154                 uint64_t ret_conv_7_ref = tag_ptr(ret_conv_7_copy, true);
24155                 ret_arr_ptr[h] = ret_conv_7_ref;
24156         }
24157         
24158         FREE(ret_var.data);
24159         return ret_arr;
24160 }
24161
24162 int8_tArray  __attribute__((export_name("TS_ChannelMonitor_get_counterparty_node_id"))) TS_ChannelMonitor_get_counterparty_node_id(uint64_t this_arg) {
24163         LDKChannelMonitor this_arg_conv;
24164         this_arg_conv.inner = untag_ptr(this_arg);
24165         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24167         this_arg_conv.is_owned = false;
24168         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
24169         memcpy(ret_arr->elems, ChannelMonitor_get_counterparty_node_id(&this_arg_conv).compressed_form, 33);
24170         return ret_arr;
24171 }
24172
24173 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) {
24174         LDKChannelMonitor this_arg_conv;
24175         this_arg_conv.inner = untag_ptr(this_arg);
24176         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24178         this_arg_conv.is_owned = false;
24179         void* logger_ptr = untag_ptr(logger);
24180         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
24181         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
24182         LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
24183         ptrArray ret_arr = NULL;
24184         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
24185         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
24186         for (size_t m = 0; m < ret_var.datalen; m++) {
24187                 LDKTransaction ret_conv_12_var = ret_var.data[m];
24188                 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen, __LINE__);
24189                 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
24190                 Transaction_free(ret_conv_12_var);
24191                 ret_arr_ptr[m] = ret_conv_12_arr;
24192         }
24193         
24194         FREE(ret_var.data);
24195         return ret_arr;
24196 }
24197
24198 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) {
24199         LDKChannelMonitor this_arg_conv;
24200         this_arg_conv.inner = untag_ptr(this_arg);
24201         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24203         this_arg_conv.is_owned = false;
24204         unsigned char header_arr[80];
24205         CHECK(header->arr_len == 80);
24206         memcpy(header_arr, header->elems, 80); FREE(header);
24207         unsigned char (*header_ref)[80] = &header_arr;
24208         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
24209         txdata_constr.datalen = txdata->arr_len;
24210         if (txdata_constr.datalen > 0)
24211                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
24212         else
24213                 txdata_constr.data = NULL;
24214         uint64_t* txdata_vals = txdata->elems;
24215         for (size_t c = 0; c < txdata_constr.datalen; c++) {
24216                 uint64_t txdata_conv_28 = txdata_vals[c];
24217                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
24218                 CHECK_ACCESS(txdata_conv_28_ptr);
24219                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
24220                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
24221                 txdata_constr.data[c] = txdata_conv_28_conv;
24222         }
24223         FREE(txdata);
24224         void* broadcaster_ptr = untag_ptr(broadcaster);
24225         CHECK_ACCESS(broadcaster_ptr);
24226         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
24227         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
24228                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24229                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
24230         }
24231         void* fee_estimator_ptr = untag_ptr(fee_estimator);
24232         CHECK_ACCESS(fee_estimator_ptr);
24233         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
24234         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
24235                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24236                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
24237         }
24238         void* logger_ptr = untag_ptr(logger);
24239         CHECK_ACCESS(logger_ptr);
24240         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
24241         if (logger_conv.free == LDKLogger_JCalls_free) {
24242                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24243                 LDKLogger_JCalls_cloned(&logger_conv);
24244         }
24245         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);
24246         uint64_tArray ret_arr = NULL;
24247         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
24248         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
24249         for (size_t n = 0; n < ret_var.datalen; n++) {
24250                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
24251                 *ret_conv_39_conv = ret_var.data[n];
24252                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
24253         }
24254         
24255         FREE(ret_var.data);
24256         return ret_arr;
24257 }
24258
24259 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) {
24260         LDKChannelMonitor this_arg_conv;
24261         this_arg_conv.inner = untag_ptr(this_arg);
24262         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24264         this_arg_conv.is_owned = false;
24265         unsigned char header_arr[80];
24266         CHECK(header->arr_len == 80);
24267         memcpy(header_arr, header->elems, 80); FREE(header);
24268         unsigned char (*header_ref)[80] = &header_arr;
24269         void* broadcaster_ptr = untag_ptr(broadcaster);
24270         CHECK_ACCESS(broadcaster_ptr);
24271         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
24272         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
24273                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24274                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
24275         }
24276         void* fee_estimator_ptr = untag_ptr(fee_estimator);
24277         CHECK_ACCESS(fee_estimator_ptr);
24278         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
24279         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
24280                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24281                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
24282         }
24283         void* logger_ptr = untag_ptr(logger);
24284         CHECK_ACCESS(logger_ptr);
24285         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
24286         if (logger_conv.free == LDKLogger_JCalls_free) {
24287                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24288                 LDKLogger_JCalls_cloned(&logger_conv);
24289         }
24290         ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
24291 }
24292
24293 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) {
24294         LDKChannelMonitor this_arg_conv;
24295         this_arg_conv.inner = untag_ptr(this_arg);
24296         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24297         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24298         this_arg_conv.is_owned = false;
24299         unsigned char header_arr[80];
24300         CHECK(header->arr_len == 80);
24301         memcpy(header_arr, header->elems, 80); FREE(header);
24302         unsigned char (*header_ref)[80] = &header_arr;
24303         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
24304         txdata_constr.datalen = txdata->arr_len;
24305         if (txdata_constr.datalen > 0)
24306                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
24307         else
24308                 txdata_constr.data = NULL;
24309         uint64_t* txdata_vals = txdata->elems;
24310         for (size_t c = 0; c < txdata_constr.datalen; c++) {
24311                 uint64_t txdata_conv_28 = txdata_vals[c];
24312                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
24313                 CHECK_ACCESS(txdata_conv_28_ptr);
24314                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
24315                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
24316                 txdata_constr.data[c] = txdata_conv_28_conv;
24317         }
24318         FREE(txdata);
24319         void* broadcaster_ptr = untag_ptr(broadcaster);
24320         CHECK_ACCESS(broadcaster_ptr);
24321         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
24322         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
24323                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24324                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
24325         }
24326         void* fee_estimator_ptr = untag_ptr(fee_estimator);
24327         CHECK_ACCESS(fee_estimator_ptr);
24328         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
24329         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
24330                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24331                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
24332         }
24333         void* logger_ptr = untag_ptr(logger);
24334         CHECK_ACCESS(logger_ptr);
24335         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
24336         if (logger_conv.free == LDKLogger_JCalls_free) {
24337                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24338                 LDKLogger_JCalls_cloned(&logger_conv);
24339         }
24340         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);
24341         uint64_tArray ret_arr = NULL;
24342         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
24343         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
24344         for (size_t n = 0; n < ret_var.datalen; n++) {
24345                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
24346                 *ret_conv_39_conv = ret_var.data[n];
24347                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
24348         }
24349         
24350         FREE(ret_var.data);
24351         return ret_arr;
24352 }
24353
24354 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) {
24355         LDKChannelMonitor this_arg_conv;
24356         this_arg_conv.inner = untag_ptr(this_arg);
24357         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24359         this_arg_conv.is_owned = false;
24360         unsigned char txid_arr[32];
24361         CHECK(txid->arr_len == 32);
24362         memcpy(txid_arr, txid->elems, 32); FREE(txid);
24363         unsigned char (*txid_ref)[32] = &txid_arr;
24364         void* broadcaster_ptr = untag_ptr(broadcaster);
24365         CHECK_ACCESS(broadcaster_ptr);
24366         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
24367         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
24368                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24369                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
24370         }
24371         void* fee_estimator_ptr = untag_ptr(fee_estimator);
24372         CHECK_ACCESS(fee_estimator_ptr);
24373         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
24374         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
24375                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24376                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
24377         }
24378         void* logger_ptr = untag_ptr(logger);
24379         CHECK_ACCESS(logger_ptr);
24380         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
24381         if (logger_conv.free == LDKLogger_JCalls_free) {
24382                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24383                 LDKLogger_JCalls_cloned(&logger_conv);
24384         }
24385         ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
24386 }
24387
24388 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) {
24389         LDKChannelMonitor this_arg_conv;
24390         this_arg_conv.inner = untag_ptr(this_arg);
24391         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24392         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24393         this_arg_conv.is_owned = false;
24394         unsigned char header_arr[80];
24395         CHECK(header->arr_len == 80);
24396         memcpy(header_arr, header->elems, 80); FREE(header);
24397         unsigned char (*header_ref)[80] = &header_arr;
24398         void* broadcaster_ptr = untag_ptr(broadcaster);
24399         CHECK_ACCESS(broadcaster_ptr);
24400         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
24401         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
24402                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24403                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
24404         }
24405         void* fee_estimator_ptr = untag_ptr(fee_estimator);
24406         CHECK_ACCESS(fee_estimator_ptr);
24407         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
24408         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
24409                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24410                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
24411         }
24412         void* logger_ptr = untag_ptr(logger);
24413         CHECK_ACCESS(logger_ptr);
24414         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
24415         if (logger_conv.free == LDKLogger_JCalls_free) {
24416                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24417                 LDKLogger_JCalls_cloned(&logger_conv);
24418         }
24419         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
24420         uint64_tArray ret_arr = NULL;
24421         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
24422         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
24423         for (size_t n = 0; n < ret_var.datalen; n++) {
24424                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
24425                 *ret_conv_39_conv = ret_var.data[n];
24426                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
24427         }
24428         
24429         FREE(ret_var.data);
24430         return ret_arr;
24431 }
24432
24433 ptrArray  __attribute__((export_name("TS_ChannelMonitor_get_relevant_txids"))) TS_ChannelMonitor_get_relevant_txids(uint64_t this_arg) {
24434         LDKChannelMonitor this_arg_conv;
24435         this_arg_conv.inner = untag_ptr(this_arg);
24436         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24438         this_arg_conv.is_owned = false;
24439         LDKCVec_TxidZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
24440         ptrArray ret_arr = NULL;
24441         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
24442         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
24443         for (size_t m = 0; m < ret_var.datalen; m++) {
24444                 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
24445                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
24446                 ret_arr_ptr[m] = ret_conv_12_arr;
24447         }
24448         
24449         FREE(ret_var.data);
24450         return ret_arr;
24451 }
24452
24453 uint64_t  __attribute__((export_name("TS_ChannelMonitor_current_best_block"))) TS_ChannelMonitor_current_best_block(uint64_t this_arg) {
24454         LDKChannelMonitor this_arg_conv;
24455         this_arg_conv.inner = untag_ptr(this_arg);
24456         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24458         this_arg_conv.is_owned = false;
24459         LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
24460         uint64_t ret_ref = 0;
24461         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24462         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24463         return ret_ref;
24464 }
24465
24466 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_claimable_balances"))) TS_ChannelMonitor_get_claimable_balances(uint64_t this_arg) {
24467         LDKChannelMonitor this_arg_conv;
24468         this_arg_conv.inner = untag_ptr(this_arg);
24469         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24471         this_arg_conv.is_owned = false;
24472         LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
24473         uint64_tArray ret_arr = NULL;
24474         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
24475         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
24476         for (size_t j = 0; j < ret_var.datalen; j++) {
24477                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
24478                 *ret_conv_9_copy = ret_var.data[j];
24479                 uint64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
24480                 ret_arr_ptr[j] = ret_conv_9_ref;
24481         }
24482         
24483         FREE(ret_var.data);
24484         return ret_arr;
24485 }
24486
24487 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_read"))) TS_C2Tuple_BlockHashChannelMonitorZ_read(int8_tArray ser, uint64_t arg) {
24488         LDKu8slice ser_ref;
24489         ser_ref.datalen = ser->arr_len;
24490         ser_ref.data = ser->elems;
24491         void* arg_ptr = untag_ptr(arg);
24492         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
24493         LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg_ptr;
24494         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
24495         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
24496         FREE(ser);
24497         return tag_ptr(ret_conv, true);
24498 }
24499
24500 void  __attribute__((export_name("TS_OutPoint_free"))) TS_OutPoint_free(uint64_t this_obj) {
24501         LDKOutPoint this_obj_conv;
24502         this_obj_conv.inner = untag_ptr(this_obj);
24503         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24505         OutPoint_free(this_obj_conv);
24506 }
24507
24508 int8_tArray  __attribute__((export_name("TS_OutPoint_get_txid"))) TS_OutPoint_get_txid(uint64_t this_ptr) {
24509         LDKOutPoint this_ptr_conv;
24510         this_ptr_conv.inner = untag_ptr(this_ptr);
24511         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24513         this_ptr_conv.is_owned = false;
24514         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
24515         memcpy(ret_arr->elems, *OutPoint_get_txid(&this_ptr_conv), 32);
24516         return ret_arr;
24517 }
24518
24519 void  __attribute__((export_name("TS_OutPoint_set_txid"))) TS_OutPoint_set_txid(uint64_t this_ptr, int8_tArray val) {
24520         LDKOutPoint this_ptr_conv;
24521         this_ptr_conv.inner = untag_ptr(this_ptr);
24522         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24524         this_ptr_conv.is_owned = false;
24525         LDKThirtyTwoBytes val_ref;
24526         CHECK(val->arr_len == 32);
24527         memcpy(val_ref.data, val->elems, 32); FREE(val);
24528         OutPoint_set_txid(&this_ptr_conv, val_ref);
24529 }
24530
24531 int16_t  __attribute__((export_name("TS_OutPoint_get_index"))) TS_OutPoint_get_index(uint64_t this_ptr) {
24532         LDKOutPoint this_ptr_conv;
24533         this_ptr_conv.inner = untag_ptr(this_ptr);
24534         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24536         this_ptr_conv.is_owned = false;
24537         int16_t ret_conv = OutPoint_get_index(&this_ptr_conv);
24538         return ret_conv;
24539 }
24540
24541 void  __attribute__((export_name("TS_OutPoint_set_index"))) TS_OutPoint_set_index(uint64_t this_ptr, int16_t val) {
24542         LDKOutPoint this_ptr_conv;
24543         this_ptr_conv.inner = untag_ptr(this_ptr);
24544         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24546         this_ptr_conv.is_owned = false;
24547         OutPoint_set_index(&this_ptr_conv, val);
24548 }
24549
24550 uint64_t  __attribute__((export_name("TS_OutPoint_new"))) TS_OutPoint_new(int8_tArray txid_arg, int16_t index_arg) {
24551         LDKThirtyTwoBytes txid_arg_ref;
24552         CHECK(txid_arg->arr_len == 32);
24553         memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
24554         LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
24555         uint64_t ret_ref = 0;
24556         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24557         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24558         return ret_ref;
24559 }
24560
24561 static inline uint64_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
24562         LDKOutPoint ret_var = OutPoint_clone(arg);
24563         uint64_t ret_ref = 0;
24564         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24565         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24566         return ret_ref;
24567 }
24568 int64_t  __attribute__((export_name("TS_OutPoint_clone_ptr"))) TS_OutPoint_clone_ptr(uint64_t arg) {
24569         LDKOutPoint arg_conv;
24570         arg_conv.inner = untag_ptr(arg);
24571         arg_conv.is_owned = ptr_is_owned(arg);
24572         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24573         arg_conv.is_owned = false;
24574         int64_t ret_conv = OutPoint_clone_ptr(&arg_conv);
24575         return ret_conv;
24576 }
24577
24578 uint64_t  __attribute__((export_name("TS_OutPoint_clone"))) TS_OutPoint_clone(uint64_t orig) {
24579         LDKOutPoint orig_conv;
24580         orig_conv.inner = untag_ptr(orig);
24581         orig_conv.is_owned = ptr_is_owned(orig);
24582         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24583         orig_conv.is_owned = false;
24584         LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
24585         uint64_t ret_ref = 0;
24586         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24587         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24588         return ret_ref;
24589 }
24590
24591 jboolean  __attribute__((export_name("TS_OutPoint_eq"))) TS_OutPoint_eq(uint64_t a, uint64_t b) {
24592         LDKOutPoint a_conv;
24593         a_conv.inner = untag_ptr(a);
24594         a_conv.is_owned = ptr_is_owned(a);
24595         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24596         a_conv.is_owned = false;
24597         LDKOutPoint b_conv;
24598         b_conv.inner = untag_ptr(b);
24599         b_conv.is_owned = ptr_is_owned(b);
24600         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
24601         b_conv.is_owned = false;
24602         jboolean ret_conv = OutPoint_eq(&a_conv, &b_conv);
24603         return ret_conv;
24604 }
24605
24606 int64_t  __attribute__((export_name("TS_OutPoint_hash"))) TS_OutPoint_hash(uint64_t o) {
24607         LDKOutPoint o_conv;
24608         o_conv.inner = untag_ptr(o);
24609         o_conv.is_owned = ptr_is_owned(o);
24610         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24611         o_conv.is_owned = false;
24612         int64_t ret_conv = OutPoint_hash(&o_conv);
24613         return ret_conv;
24614 }
24615
24616 int8_tArray  __attribute__((export_name("TS_OutPoint_to_channel_id"))) TS_OutPoint_to_channel_id(uint64_t this_arg) {
24617         LDKOutPoint this_arg_conv;
24618         this_arg_conv.inner = untag_ptr(this_arg);
24619         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24621         this_arg_conv.is_owned = false;
24622         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
24623         memcpy(ret_arr->elems, OutPoint_to_channel_id(&this_arg_conv).data, 32);
24624         return ret_arr;
24625 }
24626
24627 int8_tArray  __attribute__((export_name("TS_OutPoint_write"))) TS_OutPoint_write(uint64_t obj) {
24628         LDKOutPoint obj_conv;
24629         obj_conv.inner = untag_ptr(obj);
24630         obj_conv.is_owned = ptr_is_owned(obj);
24631         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
24632         obj_conv.is_owned = false;
24633         LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
24634         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
24635         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
24636         CVec_u8Z_free(ret_var);
24637         return ret_arr;
24638 }
24639
24640 uint64_t  __attribute__((export_name("TS_OutPoint_read"))) TS_OutPoint_read(int8_tArray ser) {
24641         LDKu8slice ser_ref;
24642         ser_ref.datalen = ser->arr_len;
24643         ser_ref.data = ser->elems;
24644         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
24645         *ret_conv = OutPoint_read(ser_ref);
24646         FREE(ser);
24647         return tag_ptr(ret_conv, true);
24648 }
24649
24650 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_free"))) TS_DelayedPaymentOutputDescriptor_free(uint64_t this_obj) {
24651         LDKDelayedPaymentOutputDescriptor this_obj_conv;
24652         this_obj_conv.inner = untag_ptr(this_obj);
24653         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24655         DelayedPaymentOutputDescriptor_free(this_obj_conv);
24656 }
24657
24658 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_outpoint"))) TS_DelayedPaymentOutputDescriptor_get_outpoint(uint64_t this_ptr) {
24659         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24660         this_ptr_conv.inner = untag_ptr(this_ptr);
24661         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24663         this_ptr_conv.is_owned = false;
24664         LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
24665         uint64_t ret_ref = 0;
24666         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24667         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24668         return ret_ref;
24669 }
24670
24671 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_outpoint"))) TS_DelayedPaymentOutputDescriptor_set_outpoint(uint64_t this_ptr, uint64_t val) {
24672         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24673         this_ptr_conv.inner = untag_ptr(this_ptr);
24674         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24676         this_ptr_conv.is_owned = false;
24677         LDKOutPoint val_conv;
24678         val_conv.inner = untag_ptr(val);
24679         val_conv.is_owned = ptr_is_owned(val);
24680         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24681         val_conv = OutPoint_clone(&val_conv);
24682         DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
24683 }
24684
24685 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_get_per_commitment_point(uint64_t this_ptr) {
24686         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24687         this_ptr_conv.inner = untag_ptr(this_ptr);
24688         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24690         this_ptr_conv.is_owned = false;
24691         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
24692         memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
24693         return ret_arr;
24694 }
24695
24696 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_set_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
24697         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24698         this_ptr_conv.inner = untag_ptr(this_ptr);
24699         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24701         this_ptr_conv.is_owned = false;
24702         LDKPublicKey val_ref;
24703         CHECK(val->arr_len == 33);
24704         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
24705         DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
24706 }
24707
24708 int16_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_get_to_self_delay(uint64_t this_ptr) {
24709         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24710         this_ptr_conv.inner = untag_ptr(this_ptr);
24711         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24713         this_ptr_conv.is_owned = false;
24714         int16_t ret_conv = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
24715         return ret_conv;
24716 }
24717
24718 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_set_to_self_delay(uint64_t this_ptr, int16_t val) {
24719         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24720         this_ptr_conv.inner = untag_ptr(this_ptr);
24721         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24723         this_ptr_conv.is_owned = false;
24724         DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
24725 }
24726
24727 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_output"))) TS_DelayedPaymentOutputDescriptor_get_output(uint64_t this_ptr) {
24728         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24729         this_ptr_conv.inner = untag_ptr(this_ptr);
24730         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24732         this_ptr_conv.is_owned = false;
24733         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
24734         *ret_ref = DelayedPaymentOutputDescriptor_get_output(&this_ptr_conv);
24735         return tag_ptr(ret_ref, true);
24736 }
24737
24738 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_output"))) TS_DelayedPaymentOutputDescriptor_set_output(uint64_t this_ptr, uint64_t val) {
24739         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24740         this_ptr_conv.inner = untag_ptr(this_ptr);
24741         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24743         this_ptr_conv.is_owned = false;
24744         void* val_ptr = untag_ptr(val);
24745         CHECK_ACCESS(val_ptr);
24746         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
24747         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
24748         DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
24749 }
24750
24751 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey(uint64_t this_ptr) {
24752         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24753         this_ptr_conv.inner = untag_ptr(this_ptr);
24754         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24756         this_ptr_conv.is_owned = false;
24757         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
24758         memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form, 33);
24759         return ret_arr;
24760 }
24761
24762 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey(uint64_t this_ptr, int8_tArray val) {
24763         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24764         this_ptr_conv.inner = untag_ptr(this_ptr);
24765         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24766         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24767         this_ptr_conv.is_owned = false;
24768         LDKPublicKey val_ref;
24769         CHECK(val->arr_len == 33);
24770         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
24771         DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
24772 }
24773
24774 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_get_channel_keys_id(uint64_t this_ptr) {
24775         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24776         this_ptr_conv.inner = untag_ptr(this_ptr);
24777         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24779         this_ptr_conv.is_owned = false;
24780         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
24781         memcpy(ret_arr->elems, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
24782         return ret_arr;
24783 }
24784
24785 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_set_channel_keys_id(uint64_t this_ptr, int8_tArray val) {
24786         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24787         this_ptr_conv.inner = untag_ptr(this_ptr);
24788         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24790         this_ptr_conv.is_owned = false;
24791         LDKThirtyTwoBytes val_ref;
24792         CHECK(val->arr_len == 32);
24793         memcpy(val_ref.data, val->elems, 32); FREE(val);
24794         DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
24795 }
24796
24797 int64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis(uint64_t this_ptr) {
24798         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24799         this_ptr_conv.inner = untag_ptr(this_ptr);
24800         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24802         this_ptr_conv.is_owned = false;
24803         int64_t ret_conv = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
24804         return ret_conv;
24805 }
24806
24807 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
24808         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24809         this_ptr_conv.inner = untag_ptr(this_ptr);
24810         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24812         this_ptr_conv.is_owned = false;
24813         DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
24814 }
24815
24816 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) {
24817         LDKOutPoint outpoint_arg_conv;
24818         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
24819         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
24820         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
24821         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
24822         LDKPublicKey per_commitment_point_arg_ref;
24823         CHECK(per_commitment_point_arg->arr_len == 33);
24824         memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
24825         void* output_arg_ptr = untag_ptr(output_arg);
24826         CHECK_ACCESS(output_arg_ptr);
24827         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
24828         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
24829         LDKPublicKey revocation_pubkey_arg_ref;
24830         CHECK(revocation_pubkey_arg->arr_len == 33);
24831         memcpy(revocation_pubkey_arg_ref.compressed_form, revocation_pubkey_arg->elems, 33); FREE(revocation_pubkey_arg);
24832         LDKThirtyTwoBytes channel_keys_id_arg_ref;
24833         CHECK(channel_keys_id_arg->arr_len == 32);
24834         memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
24835         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);
24836         uint64_t ret_ref = 0;
24837         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24838         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24839         return ret_ref;
24840 }
24841
24842 static inline uint64_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
24843         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
24844         uint64_t ret_ref = 0;
24845         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24846         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24847         return ret_ref;
24848 }
24849 int64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone_ptr"))) TS_DelayedPaymentOutputDescriptor_clone_ptr(uint64_t arg) {
24850         LDKDelayedPaymentOutputDescriptor arg_conv;
24851         arg_conv.inner = untag_ptr(arg);
24852         arg_conv.is_owned = ptr_is_owned(arg);
24853         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24854         arg_conv.is_owned = false;
24855         int64_t ret_conv = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
24856         return ret_conv;
24857 }
24858
24859 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone"))) TS_DelayedPaymentOutputDescriptor_clone(uint64_t orig) {
24860         LDKDelayedPaymentOutputDescriptor orig_conv;
24861         orig_conv.inner = untag_ptr(orig);
24862         orig_conv.is_owned = ptr_is_owned(orig);
24863         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24864         orig_conv.is_owned = false;
24865         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
24866         uint64_t ret_ref = 0;
24867         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24868         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24869         return ret_ref;
24870 }
24871
24872 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_write"))) TS_DelayedPaymentOutputDescriptor_write(uint64_t obj) {
24873         LDKDelayedPaymentOutputDescriptor obj_conv;
24874         obj_conv.inner = untag_ptr(obj);
24875         obj_conv.is_owned = ptr_is_owned(obj);
24876         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
24877         obj_conv.is_owned = false;
24878         LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
24879         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
24880         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
24881         CVec_u8Z_free(ret_var);
24882         return ret_arr;
24883 }
24884
24885 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_read"))) TS_DelayedPaymentOutputDescriptor_read(int8_tArray ser) {
24886         LDKu8slice ser_ref;
24887         ser_ref.datalen = ser->arr_len;
24888         ser_ref.data = ser->elems;
24889         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
24890         *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
24891         FREE(ser);
24892         return tag_ptr(ret_conv, true);
24893 }
24894
24895 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_free"))) TS_StaticPaymentOutputDescriptor_free(uint64_t this_obj) {
24896         LDKStaticPaymentOutputDescriptor this_obj_conv;
24897         this_obj_conv.inner = untag_ptr(this_obj);
24898         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24900         StaticPaymentOutputDescriptor_free(this_obj_conv);
24901 }
24902
24903 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_outpoint"))) TS_StaticPaymentOutputDescriptor_get_outpoint(uint64_t this_ptr) {
24904         LDKStaticPaymentOutputDescriptor this_ptr_conv;
24905         this_ptr_conv.inner = untag_ptr(this_ptr);
24906         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24908         this_ptr_conv.is_owned = false;
24909         LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
24910         uint64_t ret_ref = 0;
24911         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24912         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24913         return ret_ref;
24914 }
24915
24916 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_outpoint"))) TS_StaticPaymentOutputDescriptor_set_outpoint(uint64_t this_ptr, uint64_t val) {
24917         LDKStaticPaymentOutputDescriptor this_ptr_conv;
24918         this_ptr_conv.inner = untag_ptr(this_ptr);
24919         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24921         this_ptr_conv.is_owned = false;
24922         LDKOutPoint val_conv;
24923         val_conv.inner = untag_ptr(val);
24924         val_conv.is_owned = ptr_is_owned(val);
24925         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24926         val_conv = OutPoint_clone(&val_conv);
24927         StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
24928 }
24929
24930 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_output"))) TS_StaticPaymentOutputDescriptor_get_output(uint64_t this_ptr) {
24931         LDKStaticPaymentOutputDescriptor this_ptr_conv;
24932         this_ptr_conv.inner = untag_ptr(this_ptr);
24933         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24935         this_ptr_conv.is_owned = false;
24936         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
24937         *ret_ref = StaticPaymentOutputDescriptor_get_output(&this_ptr_conv);
24938         return tag_ptr(ret_ref, true);
24939 }
24940
24941 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_output"))) TS_StaticPaymentOutputDescriptor_set_output(uint64_t this_ptr, uint64_t val) {
24942         LDKStaticPaymentOutputDescriptor this_ptr_conv;
24943         this_ptr_conv.inner = untag_ptr(this_ptr);
24944         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24946         this_ptr_conv.is_owned = false;
24947         void* val_ptr = untag_ptr(val);
24948         CHECK_ACCESS(val_ptr);
24949         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
24950         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
24951         StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
24952 }
24953
24954 int8_tArray  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_get_channel_keys_id(uint64_t this_ptr) {
24955         LDKStaticPaymentOutputDescriptor this_ptr_conv;
24956         this_ptr_conv.inner = untag_ptr(this_ptr);
24957         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24958         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24959         this_ptr_conv.is_owned = false;
24960         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
24961         memcpy(ret_arr->elems, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
24962         return ret_arr;
24963 }
24964
24965 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_set_channel_keys_id(uint64_t this_ptr, int8_tArray val) {
24966         LDKStaticPaymentOutputDescriptor this_ptr_conv;
24967         this_ptr_conv.inner = untag_ptr(this_ptr);
24968         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24970         this_ptr_conv.is_owned = false;
24971         LDKThirtyTwoBytes val_ref;
24972         CHECK(val->arr_len == 32);
24973         memcpy(val_ref.data, val->elems, 32); FREE(val);
24974         StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
24975 }
24976
24977 int64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis(uint64_t this_ptr) {
24978         LDKStaticPaymentOutputDescriptor this_ptr_conv;
24979         this_ptr_conv.inner = untag_ptr(this_ptr);
24980         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24982         this_ptr_conv.is_owned = false;
24983         int64_t ret_conv = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
24984         return ret_conv;
24985 }
24986
24987 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
24988         LDKStaticPaymentOutputDescriptor this_ptr_conv;
24989         this_ptr_conv.inner = untag_ptr(this_ptr);
24990         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24992         this_ptr_conv.is_owned = false;
24993         StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
24994 }
24995
24996 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) {
24997         LDKOutPoint outpoint_arg_conv;
24998         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
24999         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
25000         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
25001         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
25002         void* output_arg_ptr = untag_ptr(output_arg);
25003         CHECK_ACCESS(output_arg_ptr);
25004         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
25005         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
25006         LDKThirtyTwoBytes channel_keys_id_arg_ref;
25007         CHECK(channel_keys_id_arg->arr_len == 32);
25008         memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
25009         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
25010         uint64_t ret_ref = 0;
25011         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25012         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25013         return ret_ref;
25014 }
25015
25016 static inline uint64_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
25017         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
25018         uint64_t ret_ref = 0;
25019         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25020         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25021         return ret_ref;
25022 }
25023 int64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone_ptr"))) TS_StaticPaymentOutputDescriptor_clone_ptr(uint64_t arg) {
25024         LDKStaticPaymentOutputDescriptor arg_conv;
25025         arg_conv.inner = untag_ptr(arg);
25026         arg_conv.is_owned = ptr_is_owned(arg);
25027         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25028         arg_conv.is_owned = false;
25029         int64_t ret_conv = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
25030         return ret_conv;
25031 }
25032
25033 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone"))) TS_StaticPaymentOutputDescriptor_clone(uint64_t orig) {
25034         LDKStaticPaymentOutputDescriptor orig_conv;
25035         orig_conv.inner = untag_ptr(orig);
25036         orig_conv.is_owned = ptr_is_owned(orig);
25037         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25038         orig_conv.is_owned = false;
25039         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
25040         uint64_t ret_ref = 0;
25041         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25042         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25043         return ret_ref;
25044 }
25045
25046 int8_tArray  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_write"))) TS_StaticPaymentOutputDescriptor_write(uint64_t obj) {
25047         LDKStaticPaymentOutputDescriptor obj_conv;
25048         obj_conv.inner = untag_ptr(obj);
25049         obj_conv.is_owned = ptr_is_owned(obj);
25050         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25051         obj_conv.is_owned = false;
25052         LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
25053         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
25054         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
25055         CVec_u8Z_free(ret_var);
25056         return ret_arr;
25057 }
25058
25059 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_read"))) TS_StaticPaymentOutputDescriptor_read(int8_tArray ser) {
25060         LDKu8slice ser_ref;
25061         ser_ref.datalen = ser->arr_len;
25062         ser_ref.data = ser->elems;
25063         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
25064         *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
25065         FREE(ser);
25066         return tag_ptr(ret_conv, true);
25067 }
25068
25069 void  __attribute__((export_name("TS_SpendableOutputDescriptor_free"))) TS_SpendableOutputDescriptor_free(uint64_t this_ptr) {
25070         if (!ptr_is_owned(this_ptr)) return;
25071         void* this_ptr_ptr = untag_ptr(this_ptr);
25072         CHECK_ACCESS(this_ptr_ptr);
25073         LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
25074         FREE(untag_ptr(this_ptr));
25075         SpendableOutputDescriptor_free(this_ptr_conv);
25076 }
25077
25078 static inline uint64_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
25079         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
25080         *ret_copy = SpendableOutputDescriptor_clone(arg);
25081         uint64_t ret_ref = tag_ptr(ret_copy, true);
25082         return ret_ref;
25083 }
25084 int64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_clone_ptr"))) TS_SpendableOutputDescriptor_clone_ptr(uint64_t arg) {
25085         LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)untag_ptr(arg);
25086         int64_t ret_conv = SpendableOutputDescriptor_clone_ptr(arg_conv);
25087         return ret_conv;
25088 }
25089
25090 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_clone"))) TS_SpendableOutputDescriptor_clone(uint64_t orig) {
25091         LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)untag_ptr(orig);
25092         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
25093         *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
25094         uint64_t ret_ref = tag_ptr(ret_copy, true);
25095         return ret_ref;
25096 }
25097
25098 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_static_output"))) TS_SpendableOutputDescriptor_static_output(uint64_t outpoint, uint64_t output) {
25099         LDKOutPoint outpoint_conv;
25100         outpoint_conv.inner = untag_ptr(outpoint);
25101         outpoint_conv.is_owned = ptr_is_owned(outpoint);
25102         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
25103         outpoint_conv = OutPoint_clone(&outpoint_conv);
25104         void* output_ptr = untag_ptr(output);
25105         CHECK_ACCESS(output_ptr);
25106         LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
25107         output_conv = TxOut_clone((LDKTxOut*)untag_ptr(output));
25108         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
25109         *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
25110         uint64_t ret_ref = tag_ptr(ret_copy, true);
25111         return ret_ref;
25112 }
25113
25114 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_delayed_payment_output"))) TS_SpendableOutputDescriptor_delayed_payment_output(uint64_t a) {
25115         LDKDelayedPaymentOutputDescriptor a_conv;
25116         a_conv.inner = untag_ptr(a);
25117         a_conv.is_owned = ptr_is_owned(a);
25118         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25119         a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
25120         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
25121         *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
25122         uint64_t ret_ref = tag_ptr(ret_copy, true);
25123         return ret_ref;
25124 }
25125
25126 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_static_payment_output"))) TS_SpendableOutputDescriptor_static_payment_output(uint64_t a) {
25127         LDKStaticPaymentOutputDescriptor a_conv;
25128         a_conv.inner = untag_ptr(a);
25129         a_conv.is_owned = ptr_is_owned(a);
25130         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25131         a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
25132         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
25133         *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
25134         uint64_t ret_ref = tag_ptr(ret_copy, true);
25135         return ret_ref;
25136 }
25137
25138 int8_tArray  __attribute__((export_name("TS_SpendableOutputDescriptor_write"))) TS_SpendableOutputDescriptor_write(uint64_t obj) {
25139         LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)untag_ptr(obj);
25140         LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
25141         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
25142         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
25143         CVec_u8Z_free(ret_var);
25144         return ret_arr;
25145 }
25146
25147 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_read"))) TS_SpendableOutputDescriptor_read(int8_tArray ser) {
25148         LDKu8slice ser_ref;
25149         ser_ref.datalen = ser->arr_len;
25150         ser_ref.data = ser->elems;
25151         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
25152         *ret_conv = SpendableOutputDescriptor_read(ser_ref);
25153         FREE(ser);
25154         return tag_ptr(ret_conv, true);
25155 }
25156
25157 void  __attribute__((export_name("TS_BaseSign_free"))) TS_BaseSign_free(uint64_t this_ptr) {
25158         if (!ptr_is_owned(this_ptr)) return;
25159         void* this_ptr_ptr = untag_ptr(this_ptr);
25160         CHECK_ACCESS(this_ptr_ptr);
25161         LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(this_ptr_ptr);
25162         FREE(untag_ptr(this_ptr));
25163         BaseSign_free(this_ptr_conv);
25164 }
25165
25166 static inline uint64_t Sign_clone_ptr(LDKSign *NONNULL_PTR arg) {
25167         LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
25168         *ret_ret = Sign_clone(arg);
25169         return tag_ptr(ret_ret, true);
25170 }
25171 int64_t  __attribute__((export_name("TS_Sign_clone_ptr"))) TS_Sign_clone_ptr(uint64_t arg) {
25172         void* arg_ptr = untag_ptr(arg);
25173         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
25174         LDKSign* arg_conv = (LDKSign*)arg_ptr;
25175         int64_t ret_conv = Sign_clone_ptr(arg_conv);
25176         return ret_conv;
25177 }
25178
25179 uint64_t  __attribute__((export_name("TS_Sign_clone"))) TS_Sign_clone(uint64_t orig) {
25180         void* orig_ptr = untag_ptr(orig);
25181         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
25182         LDKSign* orig_conv = (LDKSign*)orig_ptr;
25183         LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
25184         *ret_ret = Sign_clone(orig_conv);
25185         return tag_ptr(ret_ret, true);
25186 }
25187
25188 void  __attribute__((export_name("TS_Sign_free"))) TS_Sign_free(uint64_t this_ptr) {
25189         if (!ptr_is_owned(this_ptr)) return;
25190         void* this_ptr_ptr = untag_ptr(this_ptr);
25191         CHECK_ACCESS(this_ptr_ptr);
25192         LDKSign this_ptr_conv = *(LDKSign*)(this_ptr_ptr);
25193         FREE(untag_ptr(this_ptr));
25194         Sign_free(this_ptr_conv);
25195 }
25196
25197 uint32_t  __attribute__((export_name("TS_Recipient_clone"))) TS_Recipient_clone(uint64_t orig) {
25198         LDKRecipient* orig_conv = (LDKRecipient*)untag_ptr(orig);
25199         uint32_t ret_conv = LDKRecipient_to_js(Recipient_clone(orig_conv));
25200         return ret_conv;
25201 }
25202
25203 uint32_t  __attribute__((export_name("TS_Recipient_node"))) TS_Recipient_node() {
25204         uint32_t ret_conv = LDKRecipient_to_js(Recipient_node());
25205         return ret_conv;
25206 }
25207
25208 uint32_t  __attribute__((export_name("TS_Recipient_phantom_node"))) TS_Recipient_phantom_node() {
25209         uint32_t ret_conv = LDKRecipient_to_js(Recipient_phantom_node());
25210         return ret_conv;
25211 }
25212
25213 void  __attribute__((export_name("TS_KeysInterface_free"))) TS_KeysInterface_free(uint64_t this_ptr) {
25214         if (!ptr_is_owned(this_ptr)) return;
25215         void* this_ptr_ptr = untag_ptr(this_ptr);
25216         CHECK_ACCESS(this_ptr_ptr);
25217         LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(this_ptr_ptr);
25218         FREE(untag_ptr(this_ptr));
25219         KeysInterface_free(this_ptr_conv);
25220 }
25221
25222 void  __attribute__((export_name("TS_InMemorySigner_free"))) TS_InMemorySigner_free(uint64_t this_obj) {
25223         LDKInMemorySigner this_obj_conv;
25224         this_obj_conv.inner = untag_ptr(this_obj);
25225         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25227         InMemorySigner_free(this_obj_conv);
25228 }
25229
25230 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_funding_key"))) TS_InMemorySigner_get_funding_key(uint64_t this_ptr) {
25231         LDKInMemorySigner this_ptr_conv;
25232         this_ptr_conv.inner = untag_ptr(this_ptr);
25233         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25235         this_ptr_conv.is_owned = false;
25236         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
25237         memcpy(ret_arr->elems, *InMemorySigner_get_funding_key(&this_ptr_conv), 32);
25238         return ret_arr;
25239 }
25240
25241 void  __attribute__((export_name("TS_InMemorySigner_set_funding_key"))) TS_InMemorySigner_set_funding_key(uint64_t this_ptr, int8_tArray val) {
25242         LDKInMemorySigner this_ptr_conv;
25243         this_ptr_conv.inner = untag_ptr(this_ptr);
25244         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25246         this_ptr_conv.is_owned = false;
25247         LDKSecretKey val_ref;
25248         CHECK(val->arr_len == 32);
25249         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
25250         InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
25251 }
25252
25253 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_revocation_base_key"))) TS_InMemorySigner_get_revocation_base_key(uint64_t this_ptr) {
25254         LDKInMemorySigner this_ptr_conv;
25255         this_ptr_conv.inner = untag_ptr(this_ptr);
25256         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25258         this_ptr_conv.is_owned = false;
25259         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
25260         memcpy(ret_arr->elems, *InMemorySigner_get_revocation_base_key(&this_ptr_conv), 32);
25261         return ret_arr;
25262 }
25263
25264 void  __attribute__((export_name("TS_InMemorySigner_set_revocation_base_key"))) TS_InMemorySigner_set_revocation_base_key(uint64_t this_ptr, int8_tArray val) {
25265         LDKInMemorySigner this_ptr_conv;
25266         this_ptr_conv.inner = untag_ptr(this_ptr);
25267         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25269         this_ptr_conv.is_owned = false;
25270         LDKSecretKey val_ref;
25271         CHECK(val->arr_len == 32);
25272         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
25273         InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
25274 }
25275
25276 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_payment_key"))) TS_InMemorySigner_get_payment_key(uint64_t this_ptr) {
25277         LDKInMemorySigner this_ptr_conv;
25278         this_ptr_conv.inner = untag_ptr(this_ptr);
25279         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25281         this_ptr_conv.is_owned = false;
25282         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
25283         memcpy(ret_arr->elems, *InMemorySigner_get_payment_key(&this_ptr_conv), 32);
25284         return ret_arr;
25285 }
25286
25287 void  __attribute__((export_name("TS_InMemorySigner_set_payment_key"))) TS_InMemorySigner_set_payment_key(uint64_t this_ptr, int8_tArray val) {
25288         LDKInMemorySigner this_ptr_conv;
25289         this_ptr_conv.inner = untag_ptr(this_ptr);
25290         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25291         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25292         this_ptr_conv.is_owned = false;
25293         LDKSecretKey val_ref;
25294         CHECK(val->arr_len == 32);
25295         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
25296         InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
25297 }
25298
25299 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_delayed_payment_base_key"))) TS_InMemorySigner_get_delayed_payment_base_key(uint64_t this_ptr) {
25300         LDKInMemorySigner this_ptr_conv;
25301         this_ptr_conv.inner = untag_ptr(this_ptr);
25302         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25304         this_ptr_conv.is_owned = false;
25305         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
25306         memcpy(ret_arr->elems, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv), 32);
25307         return ret_arr;
25308 }
25309
25310 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) {
25311         LDKInMemorySigner this_ptr_conv;
25312         this_ptr_conv.inner = untag_ptr(this_ptr);
25313         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25315         this_ptr_conv.is_owned = false;
25316         LDKSecretKey val_ref;
25317         CHECK(val->arr_len == 32);
25318         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
25319         InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
25320 }
25321
25322 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_htlc_base_key"))) TS_InMemorySigner_get_htlc_base_key(uint64_t this_ptr) {
25323         LDKInMemorySigner this_ptr_conv;
25324         this_ptr_conv.inner = untag_ptr(this_ptr);
25325         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25327         this_ptr_conv.is_owned = false;
25328         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
25329         memcpy(ret_arr->elems, *InMemorySigner_get_htlc_base_key(&this_ptr_conv), 32);
25330         return ret_arr;
25331 }
25332
25333 void  __attribute__((export_name("TS_InMemorySigner_set_htlc_base_key"))) TS_InMemorySigner_set_htlc_base_key(uint64_t this_ptr, int8_tArray val) {
25334         LDKInMemorySigner this_ptr_conv;
25335         this_ptr_conv.inner = untag_ptr(this_ptr);
25336         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25337         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25338         this_ptr_conv.is_owned = false;
25339         LDKSecretKey val_ref;
25340         CHECK(val->arr_len == 32);
25341         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
25342         InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
25343 }
25344
25345 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_commitment_seed"))) TS_InMemorySigner_get_commitment_seed(uint64_t this_ptr) {
25346         LDKInMemorySigner this_ptr_conv;
25347         this_ptr_conv.inner = untag_ptr(this_ptr);
25348         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25350         this_ptr_conv.is_owned = false;
25351         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
25352         memcpy(ret_arr->elems, *InMemorySigner_get_commitment_seed(&this_ptr_conv), 32);
25353         return ret_arr;
25354 }
25355
25356 void  __attribute__((export_name("TS_InMemorySigner_set_commitment_seed"))) TS_InMemorySigner_set_commitment_seed(uint64_t this_ptr, int8_tArray val) {
25357         LDKInMemorySigner this_ptr_conv;
25358         this_ptr_conv.inner = untag_ptr(this_ptr);
25359         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25361         this_ptr_conv.is_owned = false;
25362         LDKThirtyTwoBytes val_ref;
25363         CHECK(val->arr_len == 32);
25364         memcpy(val_ref.data, val->elems, 32); FREE(val);
25365         InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
25366 }
25367
25368 static inline uint64_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
25369         LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
25370         uint64_t ret_ref = 0;
25371         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25372         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25373         return ret_ref;
25374 }
25375 int64_t  __attribute__((export_name("TS_InMemorySigner_clone_ptr"))) TS_InMemorySigner_clone_ptr(uint64_t arg) {
25376         LDKInMemorySigner arg_conv;
25377         arg_conv.inner = untag_ptr(arg);
25378         arg_conv.is_owned = ptr_is_owned(arg);
25379         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25380         arg_conv.is_owned = false;
25381         int64_t ret_conv = InMemorySigner_clone_ptr(&arg_conv);
25382         return ret_conv;
25383 }
25384
25385 uint64_t  __attribute__((export_name("TS_InMemorySigner_clone"))) TS_InMemorySigner_clone(uint64_t orig) {
25386         LDKInMemorySigner orig_conv;
25387         orig_conv.inner = untag_ptr(orig);
25388         orig_conv.is_owned = ptr_is_owned(orig);
25389         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25390         orig_conv.is_owned = false;
25391         LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
25392         uint64_t ret_ref = 0;
25393         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25394         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25395         return ret_ref;
25396 }
25397
25398 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) {
25399         LDKSecretKey node_secret_ref;
25400         CHECK(node_secret->arr_len == 32);
25401         memcpy(node_secret_ref.bytes, node_secret->elems, 32); FREE(node_secret);
25402         LDKSecretKey funding_key_ref;
25403         CHECK(funding_key->arr_len == 32);
25404         memcpy(funding_key_ref.bytes, funding_key->elems, 32); FREE(funding_key);
25405         LDKSecretKey revocation_base_key_ref;
25406         CHECK(revocation_base_key->arr_len == 32);
25407         memcpy(revocation_base_key_ref.bytes, revocation_base_key->elems, 32); FREE(revocation_base_key);
25408         LDKSecretKey payment_key_ref;
25409         CHECK(payment_key->arr_len == 32);
25410         memcpy(payment_key_ref.bytes, payment_key->elems, 32); FREE(payment_key);
25411         LDKSecretKey delayed_payment_base_key_ref;
25412         CHECK(delayed_payment_base_key->arr_len == 32);
25413         memcpy(delayed_payment_base_key_ref.bytes, delayed_payment_base_key->elems, 32); FREE(delayed_payment_base_key);
25414         LDKSecretKey htlc_base_key_ref;
25415         CHECK(htlc_base_key->arr_len == 32);
25416         memcpy(htlc_base_key_ref.bytes, htlc_base_key->elems, 32); FREE(htlc_base_key);
25417         LDKThirtyTwoBytes commitment_seed_ref;
25418         CHECK(commitment_seed->arr_len == 32);
25419         memcpy(commitment_seed_ref.data, commitment_seed->elems, 32); FREE(commitment_seed);
25420         LDKThirtyTwoBytes channel_keys_id_ref;
25421         CHECK(channel_keys_id->arr_len == 32);
25422         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
25423         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);
25424         uint64_t ret_ref = 0;
25425         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25426         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25427         return ret_ref;
25428 }
25429
25430 uint64_t  __attribute__((export_name("TS_InMemorySigner_counterparty_pubkeys"))) TS_InMemorySigner_counterparty_pubkeys(uint64_t this_arg) {
25431         LDKInMemorySigner this_arg_conv;
25432         this_arg_conv.inner = untag_ptr(this_arg);
25433         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25434         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25435         this_arg_conv.is_owned = false;
25436         LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
25437         uint64_t ret_ref = 0;
25438         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25439         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25440         return ret_ref;
25441 }
25442
25443 int16_t  __attribute__((export_name("TS_InMemorySigner_counterparty_selected_contest_delay"))) TS_InMemorySigner_counterparty_selected_contest_delay(uint64_t this_arg) {
25444         LDKInMemorySigner this_arg_conv;
25445         this_arg_conv.inner = untag_ptr(this_arg);
25446         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25448         this_arg_conv.is_owned = false;
25449         int16_t ret_conv = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
25450         return ret_conv;
25451 }
25452
25453 int16_t  __attribute__((export_name("TS_InMemorySigner_holder_selected_contest_delay"))) TS_InMemorySigner_holder_selected_contest_delay(uint64_t this_arg) {
25454         LDKInMemorySigner this_arg_conv;
25455         this_arg_conv.inner = untag_ptr(this_arg);
25456         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25458         this_arg_conv.is_owned = false;
25459         int16_t ret_conv = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
25460         return ret_conv;
25461 }
25462
25463 jboolean  __attribute__((export_name("TS_InMemorySigner_is_outbound"))) TS_InMemorySigner_is_outbound(uint64_t this_arg) {
25464         LDKInMemorySigner this_arg_conv;
25465         this_arg_conv.inner = untag_ptr(this_arg);
25466         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25468         this_arg_conv.is_owned = false;
25469         jboolean ret_conv = InMemorySigner_is_outbound(&this_arg_conv);
25470         return ret_conv;
25471 }
25472
25473 uint64_t  __attribute__((export_name("TS_InMemorySigner_funding_outpoint"))) TS_InMemorySigner_funding_outpoint(uint64_t this_arg) {
25474         LDKInMemorySigner this_arg_conv;
25475         this_arg_conv.inner = untag_ptr(this_arg);
25476         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25478         this_arg_conv.is_owned = false;
25479         LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
25480         uint64_t ret_ref = 0;
25481         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25482         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25483         return ret_ref;
25484 }
25485
25486 uint64_t  __attribute__((export_name("TS_InMemorySigner_get_channel_parameters"))) TS_InMemorySigner_get_channel_parameters(uint64_t this_arg) {
25487         LDKInMemorySigner this_arg_conv;
25488         this_arg_conv.inner = untag_ptr(this_arg);
25489         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25490         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25491         this_arg_conv.is_owned = false;
25492         LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
25493         uint64_t ret_ref = 0;
25494         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25495         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25496         return ret_ref;
25497 }
25498
25499 jboolean  __attribute__((export_name("TS_InMemorySigner_opt_anchors"))) TS_InMemorySigner_opt_anchors(uint64_t this_arg) {
25500         LDKInMemorySigner this_arg_conv;
25501         this_arg_conv.inner = untag_ptr(this_arg);
25502         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25504         this_arg_conv.is_owned = false;
25505         jboolean ret_conv = InMemorySigner_opt_anchors(&this_arg_conv);
25506         return ret_conv;
25507 }
25508
25509 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) {
25510         LDKInMemorySigner this_arg_conv;
25511         this_arg_conv.inner = untag_ptr(this_arg);
25512         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25514         this_arg_conv.is_owned = false;
25515         LDKTransaction spend_tx_ref;
25516         spend_tx_ref.datalen = spend_tx->arr_len;
25517         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
25518         memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
25519         spend_tx_ref.data_is_owned = true;
25520         LDKStaticPaymentOutputDescriptor descriptor_conv;
25521         descriptor_conv.inner = untag_ptr(descriptor);
25522         descriptor_conv.is_owned = ptr_is_owned(descriptor);
25523         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
25524         descriptor_conv.is_owned = false;
25525         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
25526         *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
25527         return tag_ptr(ret_conv, true);
25528 }
25529
25530 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) {
25531         LDKInMemorySigner this_arg_conv;
25532         this_arg_conv.inner = untag_ptr(this_arg);
25533         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25535         this_arg_conv.is_owned = false;
25536         LDKTransaction spend_tx_ref;
25537         spend_tx_ref.datalen = spend_tx->arr_len;
25538         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
25539         memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
25540         spend_tx_ref.data_is_owned = true;
25541         LDKDelayedPaymentOutputDescriptor descriptor_conv;
25542         descriptor_conv.inner = untag_ptr(descriptor);
25543         descriptor_conv.is_owned = ptr_is_owned(descriptor);
25544         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
25545         descriptor_conv.is_owned = false;
25546         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
25547         *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
25548         return tag_ptr(ret_conv, true);
25549 }
25550
25551 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_BaseSign"))) TS_InMemorySigner_as_BaseSign(uint64_t this_arg) {
25552         LDKInMemorySigner this_arg_conv;
25553         this_arg_conv.inner = untag_ptr(this_arg);
25554         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25556         this_arg_conv.is_owned = false;
25557         LDKBaseSign* ret_ret = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
25558         *ret_ret = InMemorySigner_as_BaseSign(&this_arg_conv);
25559         return tag_ptr(ret_ret, true);
25560 }
25561
25562 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_Sign"))) TS_InMemorySigner_as_Sign(uint64_t this_arg) {
25563         LDKInMemorySigner this_arg_conv;
25564         this_arg_conv.inner = untag_ptr(this_arg);
25565         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25567         this_arg_conv.is_owned = false;
25568         LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
25569         *ret_ret = InMemorySigner_as_Sign(&this_arg_conv);
25570         return tag_ptr(ret_ret, true);
25571 }
25572
25573 int8_tArray  __attribute__((export_name("TS_InMemorySigner_write"))) TS_InMemorySigner_write(uint64_t obj) {
25574         LDKInMemorySigner obj_conv;
25575         obj_conv.inner = untag_ptr(obj);
25576         obj_conv.is_owned = ptr_is_owned(obj);
25577         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25578         obj_conv.is_owned = false;
25579         LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
25580         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
25581         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
25582         CVec_u8Z_free(ret_var);
25583         return ret_arr;
25584 }
25585
25586 uint64_t  __attribute__((export_name("TS_InMemorySigner_read"))) TS_InMemorySigner_read(int8_tArray ser, int8_tArray arg) {
25587         LDKu8slice ser_ref;
25588         ser_ref.datalen = ser->arr_len;
25589         ser_ref.data = ser->elems;
25590         LDKSecretKey arg_ref;
25591         CHECK(arg->arr_len == 32);
25592         memcpy(arg_ref.bytes, arg->elems, 32); FREE(arg);
25593         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
25594         *ret_conv = InMemorySigner_read(ser_ref, arg_ref);
25595         FREE(ser);
25596         return tag_ptr(ret_conv, true);
25597 }
25598
25599 void  __attribute__((export_name("TS_KeysManager_free"))) TS_KeysManager_free(uint64_t this_obj) {
25600         LDKKeysManager this_obj_conv;
25601         this_obj_conv.inner = untag_ptr(this_obj);
25602         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25604         KeysManager_free(this_obj_conv);
25605 }
25606
25607 uint64_t  __attribute__((export_name("TS_KeysManager_new"))) TS_KeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
25608         unsigned char seed_arr[32];
25609         CHECK(seed->arr_len == 32);
25610         memcpy(seed_arr, seed->elems, 32); FREE(seed);
25611         unsigned char (*seed_ref)[32] = &seed_arr;
25612         LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
25613         uint64_t ret_ref = 0;
25614         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25615         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25616         return ret_ref;
25617 }
25618
25619 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) {
25620         LDKKeysManager this_arg_conv;
25621         this_arg_conv.inner = untag_ptr(this_arg);
25622         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25624         this_arg_conv.is_owned = false;
25625         unsigned char params_arr[32];
25626         CHECK(params->arr_len == 32);
25627         memcpy(params_arr, params->elems, 32); FREE(params);
25628         unsigned char (*params_ref)[32] = &params_arr;
25629         LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
25630         uint64_t ret_ref = 0;
25631         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25632         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25633         return ret_ref;
25634 }
25635
25636 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) {
25637         LDKKeysManager this_arg_conv;
25638         this_arg_conv.inner = untag_ptr(this_arg);
25639         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25641         this_arg_conv.is_owned = false;
25642         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
25643         descriptors_constr.datalen = descriptors->arr_len;
25644         if (descriptors_constr.datalen > 0)
25645                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
25646         else
25647                 descriptors_constr.data = NULL;
25648         uint64_t* descriptors_vals = descriptors->elems;
25649         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
25650                 uint64_t descriptors_conv_27 = descriptors_vals[b];
25651                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
25652                 CHECK_ACCESS(descriptors_conv_27_ptr);
25653                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
25654                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
25655                 descriptors_constr.data[b] = descriptors_conv_27_conv;
25656         }
25657         FREE(descriptors);
25658         LDKCVec_TxOutZ outputs_constr;
25659         outputs_constr.datalen = outputs->arr_len;
25660         if (outputs_constr.datalen > 0)
25661                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
25662         else
25663                 outputs_constr.data = NULL;
25664         uint64_t* outputs_vals = outputs->elems;
25665         for (size_t h = 0; h < outputs_constr.datalen; h++) {
25666                 uint64_t outputs_conv_7 = outputs_vals[h];
25667                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
25668                 CHECK_ACCESS(outputs_conv_7_ptr);
25669                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
25670                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
25671                 outputs_constr.data[h] = outputs_conv_7_conv;
25672         }
25673         FREE(outputs);
25674         LDKCVec_u8Z change_destination_script_ref;
25675         change_destination_script_ref.datalen = change_destination_script->arr_len;
25676         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
25677         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
25678         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
25679         *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
25680         return tag_ptr(ret_conv, true);
25681 }
25682
25683 uint64_t  __attribute__((export_name("TS_KeysManager_as_KeysInterface"))) TS_KeysManager_as_KeysInterface(uint64_t this_arg) {
25684         LDKKeysManager this_arg_conv;
25685         this_arg_conv.inner = untag_ptr(this_arg);
25686         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25688         this_arg_conv.is_owned = false;
25689         LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
25690         *ret_ret = KeysManager_as_KeysInterface(&this_arg_conv);
25691         return tag_ptr(ret_ret, true);
25692 }
25693
25694 void  __attribute__((export_name("TS_PhantomKeysManager_free"))) TS_PhantomKeysManager_free(uint64_t this_obj) {
25695         LDKPhantomKeysManager this_obj_conv;
25696         this_obj_conv.inner = untag_ptr(this_obj);
25697         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25698         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25699         PhantomKeysManager_free(this_obj_conv);
25700 }
25701
25702 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_as_KeysInterface"))) TS_PhantomKeysManager_as_KeysInterface(uint64_t this_arg) {
25703         LDKPhantomKeysManager this_arg_conv;
25704         this_arg_conv.inner = untag_ptr(this_arg);
25705         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25706         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25707         this_arg_conv.is_owned = false;
25708         LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
25709         *ret_ret = PhantomKeysManager_as_KeysInterface(&this_arg_conv);
25710         return tag_ptr(ret_ret, true);
25711 }
25712
25713 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) {
25714         unsigned char seed_arr[32];
25715         CHECK(seed->arr_len == 32);
25716         memcpy(seed_arr, seed->elems, 32); FREE(seed);
25717         unsigned char (*seed_ref)[32] = &seed_arr;
25718         unsigned char cross_node_seed_arr[32];
25719         CHECK(cross_node_seed->arr_len == 32);
25720         memcpy(cross_node_seed_arr, cross_node_seed->elems, 32); FREE(cross_node_seed);
25721         unsigned char (*cross_node_seed_ref)[32] = &cross_node_seed_arr;
25722         LDKPhantomKeysManager ret_var = PhantomKeysManager_new(seed_ref, starting_time_secs, starting_time_nanos, cross_node_seed_ref);
25723         uint64_t ret_ref = 0;
25724         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25725         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25726         return ret_ref;
25727 }
25728
25729 uint64_t  __attribute__((export_name("TS_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) {
25730         LDKPhantomKeysManager this_arg_conv;
25731         this_arg_conv.inner = untag_ptr(this_arg);
25732         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25734         this_arg_conv.is_owned = false;
25735         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
25736         descriptors_constr.datalen = descriptors->arr_len;
25737         if (descriptors_constr.datalen > 0)
25738                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
25739         else
25740                 descriptors_constr.data = NULL;
25741         uint64_t* descriptors_vals = descriptors->elems;
25742         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
25743                 uint64_t descriptors_conv_27 = descriptors_vals[b];
25744                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
25745                 CHECK_ACCESS(descriptors_conv_27_ptr);
25746                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
25747                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
25748                 descriptors_constr.data[b] = descriptors_conv_27_conv;
25749         }
25750         FREE(descriptors);
25751         LDKCVec_TxOutZ outputs_constr;
25752         outputs_constr.datalen = outputs->arr_len;
25753         if (outputs_constr.datalen > 0)
25754                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
25755         else
25756                 outputs_constr.data = NULL;
25757         uint64_t* outputs_vals = outputs->elems;
25758         for (size_t h = 0; h < outputs_constr.datalen; h++) {
25759                 uint64_t outputs_conv_7 = outputs_vals[h];
25760                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
25761                 CHECK_ACCESS(outputs_conv_7_ptr);
25762                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
25763                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
25764                 outputs_constr.data[h] = outputs_conv_7_conv;
25765         }
25766         FREE(outputs);
25767         LDKCVec_u8Z change_destination_script_ref;
25768         change_destination_script_ref.datalen = change_destination_script->arr_len;
25769         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
25770         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
25771         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
25772         *ret_conv = PhantomKeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
25773         return tag_ptr(ret_conv, true);
25774 }
25775
25776 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) {
25777         LDKPhantomKeysManager this_arg_conv;
25778         this_arg_conv.inner = untag_ptr(this_arg);
25779         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25781         this_arg_conv.is_owned = false;
25782         unsigned char params_arr[32];
25783         CHECK(params->arr_len == 32);
25784         memcpy(params_arr, params->elems, 32); FREE(params);
25785         unsigned char (*params_ref)[32] = &params_arr;
25786         LDKInMemorySigner ret_var = PhantomKeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
25787         uint64_t ret_ref = 0;
25788         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25789         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25790         return ret_ref;
25791 }
25792
25793 void  __attribute__((export_name("TS_ChannelManager_free"))) TS_ChannelManager_free(uint64_t this_obj) {
25794         LDKChannelManager this_obj_conv;
25795         this_obj_conv.inner = untag_ptr(this_obj);
25796         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25798         ChannelManager_free(this_obj_conv);
25799 }
25800
25801 void  __attribute__((export_name("TS_ChainParameters_free"))) TS_ChainParameters_free(uint64_t this_obj) {
25802         LDKChainParameters this_obj_conv;
25803         this_obj_conv.inner = untag_ptr(this_obj);
25804         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25806         ChainParameters_free(this_obj_conv);
25807 }
25808
25809 uint32_t  __attribute__((export_name("TS_ChainParameters_get_network"))) TS_ChainParameters_get_network(uint64_t this_ptr) {
25810         LDKChainParameters this_ptr_conv;
25811         this_ptr_conv.inner = untag_ptr(this_ptr);
25812         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25813         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25814         this_ptr_conv.is_owned = false;
25815         uint32_t ret_conv = LDKNetwork_to_js(ChainParameters_get_network(&this_ptr_conv));
25816         return ret_conv;
25817 }
25818
25819 void  __attribute__((export_name("TS_ChainParameters_set_network"))) TS_ChainParameters_set_network(uint64_t this_ptr, uint32_t val) {
25820         LDKChainParameters this_ptr_conv;
25821         this_ptr_conv.inner = untag_ptr(this_ptr);
25822         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25824         this_ptr_conv.is_owned = false;
25825         LDKNetwork val_conv = LDKNetwork_from_js(val);
25826         ChainParameters_set_network(&this_ptr_conv, val_conv);
25827 }
25828
25829 uint64_t  __attribute__((export_name("TS_ChainParameters_get_best_block"))) TS_ChainParameters_get_best_block(uint64_t this_ptr) {
25830         LDKChainParameters this_ptr_conv;
25831         this_ptr_conv.inner = untag_ptr(this_ptr);
25832         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25834         this_ptr_conv.is_owned = false;
25835         LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
25836         uint64_t ret_ref = 0;
25837         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25838         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25839         return ret_ref;
25840 }
25841
25842 void  __attribute__((export_name("TS_ChainParameters_set_best_block"))) TS_ChainParameters_set_best_block(uint64_t this_ptr, uint64_t val) {
25843         LDKChainParameters this_ptr_conv;
25844         this_ptr_conv.inner = untag_ptr(this_ptr);
25845         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25847         this_ptr_conv.is_owned = false;
25848         LDKBestBlock val_conv;
25849         val_conv.inner = untag_ptr(val);
25850         val_conv.is_owned = ptr_is_owned(val);
25851         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25852         val_conv = BestBlock_clone(&val_conv);
25853         ChainParameters_set_best_block(&this_ptr_conv, val_conv);
25854 }
25855
25856 uint64_t  __attribute__((export_name("TS_ChainParameters_new"))) TS_ChainParameters_new(uint32_t network_arg, uint64_t best_block_arg) {
25857         LDKNetwork network_arg_conv = LDKNetwork_from_js(network_arg);
25858         LDKBestBlock best_block_arg_conv;
25859         best_block_arg_conv.inner = untag_ptr(best_block_arg);
25860         best_block_arg_conv.is_owned = ptr_is_owned(best_block_arg);
25861         CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
25862         best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
25863         LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
25864         uint64_t ret_ref = 0;
25865         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25866         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25867         return ret_ref;
25868 }
25869
25870 static inline uint64_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
25871         LDKChainParameters ret_var = ChainParameters_clone(arg);
25872         uint64_t ret_ref = 0;
25873         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25874         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25875         return ret_ref;
25876 }
25877 int64_t  __attribute__((export_name("TS_ChainParameters_clone_ptr"))) TS_ChainParameters_clone_ptr(uint64_t arg) {
25878         LDKChainParameters arg_conv;
25879         arg_conv.inner = untag_ptr(arg);
25880         arg_conv.is_owned = ptr_is_owned(arg);
25881         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25882         arg_conv.is_owned = false;
25883         int64_t ret_conv = ChainParameters_clone_ptr(&arg_conv);
25884         return ret_conv;
25885 }
25886
25887 uint64_t  __attribute__((export_name("TS_ChainParameters_clone"))) TS_ChainParameters_clone(uint64_t orig) {
25888         LDKChainParameters orig_conv;
25889         orig_conv.inner = untag_ptr(orig);
25890         orig_conv.is_owned = ptr_is_owned(orig);
25891         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25892         orig_conv.is_owned = false;
25893         LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
25894         uint64_t ret_ref = 0;
25895         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25896         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25897         return ret_ref;
25898 }
25899
25900 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_free"))) TS_CounterpartyForwardingInfo_free(uint64_t this_obj) {
25901         LDKCounterpartyForwardingInfo this_obj_conv;
25902         this_obj_conv.inner = untag_ptr(this_obj);
25903         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25905         CounterpartyForwardingInfo_free(this_obj_conv);
25906 }
25907
25908 int32_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_base_msat"))) TS_CounterpartyForwardingInfo_get_fee_base_msat(uint64_t this_ptr) {
25909         LDKCounterpartyForwardingInfo this_ptr_conv;
25910         this_ptr_conv.inner = untag_ptr(this_ptr);
25911         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25913         this_ptr_conv.is_owned = false;
25914         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
25915         return ret_conv;
25916 }
25917
25918 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_base_msat"))) TS_CounterpartyForwardingInfo_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
25919         LDKCounterpartyForwardingInfo this_ptr_conv;
25920         this_ptr_conv.inner = untag_ptr(this_ptr);
25921         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25923         this_ptr_conv.is_owned = false;
25924         CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
25925 }
25926
25927 int32_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_get_fee_proportional_millionths(uint64_t this_ptr) {
25928         LDKCounterpartyForwardingInfo this_ptr_conv;
25929         this_ptr_conv.inner = untag_ptr(this_ptr);
25930         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25932         this_ptr_conv.is_owned = false;
25933         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
25934         return ret_conv;
25935 }
25936
25937 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
25938         LDKCounterpartyForwardingInfo this_ptr_conv;
25939         this_ptr_conv.inner = untag_ptr(this_ptr);
25940         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25942         this_ptr_conv.is_owned = false;
25943         CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
25944 }
25945
25946 int16_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
25947         LDKCounterpartyForwardingInfo this_ptr_conv;
25948         this_ptr_conv.inner = untag_ptr(this_ptr);
25949         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25951         this_ptr_conv.is_owned = false;
25952         int16_t ret_conv = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
25953         return ret_conv;
25954 }
25955
25956 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
25957         LDKCounterpartyForwardingInfo this_ptr_conv;
25958         this_ptr_conv.inner = untag_ptr(this_ptr);
25959         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25961         this_ptr_conv.is_owned = false;
25962         CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
25963 }
25964
25965 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) {
25966         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
25967         uint64_t ret_ref = 0;
25968         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25969         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25970         return ret_ref;
25971 }
25972
25973 static inline uint64_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
25974         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
25975         uint64_t ret_ref = 0;
25976         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25977         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25978         return ret_ref;
25979 }
25980 int64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_clone_ptr"))) TS_CounterpartyForwardingInfo_clone_ptr(uint64_t arg) {
25981         LDKCounterpartyForwardingInfo arg_conv;
25982         arg_conv.inner = untag_ptr(arg);
25983         arg_conv.is_owned = ptr_is_owned(arg);
25984         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25985         arg_conv.is_owned = false;
25986         int64_t ret_conv = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
25987         return ret_conv;
25988 }
25989
25990 uint64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_clone"))) TS_CounterpartyForwardingInfo_clone(uint64_t orig) {
25991         LDKCounterpartyForwardingInfo orig_conv;
25992         orig_conv.inner = untag_ptr(orig);
25993         orig_conv.is_owned = ptr_is_owned(orig);
25994         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25995         orig_conv.is_owned = false;
25996         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
25997         uint64_t ret_ref = 0;
25998         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25999         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26000         return ret_ref;
26001 }
26002
26003 void  __attribute__((export_name("TS_ChannelCounterparty_free"))) TS_ChannelCounterparty_free(uint64_t this_obj) {
26004         LDKChannelCounterparty this_obj_conv;
26005         this_obj_conv.inner = untag_ptr(this_obj);
26006         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26008         ChannelCounterparty_free(this_obj_conv);
26009 }
26010
26011 int8_tArray  __attribute__((export_name("TS_ChannelCounterparty_get_node_id"))) TS_ChannelCounterparty_get_node_id(uint64_t this_ptr) {
26012         LDKChannelCounterparty this_ptr_conv;
26013         this_ptr_conv.inner = untag_ptr(this_ptr);
26014         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26016         this_ptr_conv.is_owned = false;
26017         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
26018         memcpy(ret_arr->elems, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form, 33);
26019         return ret_arr;
26020 }
26021
26022 void  __attribute__((export_name("TS_ChannelCounterparty_set_node_id"))) TS_ChannelCounterparty_set_node_id(uint64_t this_ptr, int8_tArray val) {
26023         LDKChannelCounterparty this_ptr_conv;
26024         this_ptr_conv.inner = untag_ptr(this_ptr);
26025         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26027         this_ptr_conv.is_owned = false;
26028         LDKPublicKey val_ref;
26029         CHECK(val->arr_len == 33);
26030         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
26031         ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
26032 }
26033
26034 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_features"))) TS_ChannelCounterparty_get_features(uint64_t this_ptr) {
26035         LDKChannelCounterparty this_ptr_conv;
26036         this_ptr_conv.inner = untag_ptr(this_ptr);
26037         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26039         this_ptr_conv.is_owned = false;
26040         LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
26041         uint64_t ret_ref = 0;
26042         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26043         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26044         return ret_ref;
26045 }
26046
26047 void  __attribute__((export_name("TS_ChannelCounterparty_set_features"))) TS_ChannelCounterparty_set_features(uint64_t this_ptr, uint64_t val) {
26048         LDKChannelCounterparty this_ptr_conv;
26049         this_ptr_conv.inner = untag_ptr(this_ptr);
26050         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26052         this_ptr_conv.is_owned = false;
26053         LDKInitFeatures val_conv;
26054         val_conv.inner = untag_ptr(val);
26055         val_conv.is_owned = ptr_is_owned(val);
26056         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26057         val_conv = InitFeatures_clone(&val_conv);
26058         ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
26059 }
26060
26061 int64_t  __attribute__((export_name("TS_ChannelCounterparty_get_unspendable_punishment_reserve"))) TS_ChannelCounterparty_get_unspendable_punishment_reserve(uint64_t this_ptr) {
26062         LDKChannelCounterparty this_ptr_conv;
26063         this_ptr_conv.inner = untag_ptr(this_ptr);
26064         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26066         this_ptr_conv.is_owned = false;
26067         int64_t ret_conv = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
26068         return ret_conv;
26069 }
26070
26071 void  __attribute__((export_name("TS_ChannelCounterparty_set_unspendable_punishment_reserve"))) TS_ChannelCounterparty_set_unspendable_punishment_reserve(uint64_t this_ptr, int64_t val) {
26072         LDKChannelCounterparty this_ptr_conv;
26073         this_ptr_conv.inner = untag_ptr(this_ptr);
26074         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26076         this_ptr_conv.is_owned = false;
26077         ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
26078 }
26079
26080 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_forwarding_info"))) TS_ChannelCounterparty_get_forwarding_info(uint64_t this_ptr) {
26081         LDKChannelCounterparty this_ptr_conv;
26082         this_ptr_conv.inner = untag_ptr(this_ptr);
26083         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26085         this_ptr_conv.is_owned = false;
26086         LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
26087         uint64_t ret_ref = 0;
26088         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26089         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26090         return ret_ref;
26091 }
26092
26093 void  __attribute__((export_name("TS_ChannelCounterparty_set_forwarding_info"))) TS_ChannelCounterparty_set_forwarding_info(uint64_t this_ptr, uint64_t val) {
26094         LDKChannelCounterparty this_ptr_conv;
26095         this_ptr_conv.inner = untag_ptr(this_ptr);
26096         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26098         this_ptr_conv.is_owned = false;
26099         LDKCounterpartyForwardingInfo val_conv;
26100         val_conv.inner = untag_ptr(val);
26101         val_conv.is_owned = ptr_is_owned(val);
26102         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26103         val_conv = CounterpartyForwardingInfo_clone(&val_conv);
26104         ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
26105 }
26106
26107 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_outbound_htlc_minimum_msat"))) TS_ChannelCounterparty_get_outbound_htlc_minimum_msat(uint64_t this_ptr) {
26108         LDKChannelCounterparty this_ptr_conv;
26109         this_ptr_conv.inner = untag_ptr(this_ptr);
26110         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26112         this_ptr_conv.is_owned = false;
26113         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26114         *ret_copy = ChannelCounterparty_get_outbound_htlc_minimum_msat(&this_ptr_conv);
26115         uint64_t ret_ref = tag_ptr(ret_copy, true);
26116         return ret_ref;
26117 }
26118
26119 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) {
26120         LDKChannelCounterparty this_ptr_conv;
26121         this_ptr_conv.inner = untag_ptr(this_ptr);
26122         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26124         this_ptr_conv.is_owned = false;
26125         void* val_ptr = untag_ptr(val);
26126         CHECK_ACCESS(val_ptr);
26127         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
26128         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
26129         ChannelCounterparty_set_outbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
26130 }
26131
26132 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_outbound_htlc_maximum_msat"))) TS_ChannelCounterparty_get_outbound_htlc_maximum_msat(uint64_t this_ptr) {
26133         LDKChannelCounterparty this_ptr_conv;
26134         this_ptr_conv.inner = untag_ptr(this_ptr);
26135         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26137         this_ptr_conv.is_owned = false;
26138         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26139         *ret_copy = ChannelCounterparty_get_outbound_htlc_maximum_msat(&this_ptr_conv);
26140         uint64_t ret_ref = tag_ptr(ret_copy, true);
26141         return ret_ref;
26142 }
26143
26144 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) {
26145         LDKChannelCounterparty this_ptr_conv;
26146         this_ptr_conv.inner = untag_ptr(this_ptr);
26147         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26149         this_ptr_conv.is_owned = false;
26150         void* val_ptr = untag_ptr(val);
26151         CHECK_ACCESS(val_ptr);
26152         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
26153         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
26154         ChannelCounterparty_set_outbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
26155 }
26156
26157 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) {
26158         LDKPublicKey node_id_arg_ref;
26159         CHECK(node_id_arg->arr_len == 33);
26160         memcpy(node_id_arg_ref.compressed_form, node_id_arg->elems, 33); FREE(node_id_arg);
26161         LDKInitFeatures features_arg_conv;
26162         features_arg_conv.inner = untag_ptr(features_arg);
26163         features_arg_conv.is_owned = ptr_is_owned(features_arg);
26164         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
26165         features_arg_conv = InitFeatures_clone(&features_arg_conv);
26166         LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
26167         forwarding_info_arg_conv.inner = untag_ptr(forwarding_info_arg);
26168         forwarding_info_arg_conv.is_owned = ptr_is_owned(forwarding_info_arg);
26169         CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
26170         forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
26171         void* outbound_htlc_minimum_msat_arg_ptr = untag_ptr(outbound_htlc_minimum_msat_arg);
26172         CHECK_ACCESS(outbound_htlc_minimum_msat_arg_ptr);
26173         LDKCOption_u64Z outbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_minimum_msat_arg_ptr);
26174         outbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_minimum_msat_arg));
26175         void* outbound_htlc_maximum_msat_arg_ptr = untag_ptr(outbound_htlc_maximum_msat_arg);
26176         CHECK_ACCESS(outbound_htlc_maximum_msat_arg_ptr);
26177         LDKCOption_u64Z outbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_maximum_msat_arg_ptr);
26178         outbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_maximum_msat_arg));
26179         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);
26180         uint64_t ret_ref = 0;
26181         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26182         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26183         return ret_ref;
26184 }
26185
26186 static inline uint64_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
26187         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
26188         uint64_t ret_ref = 0;
26189         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26190         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26191         return ret_ref;
26192 }
26193 int64_t  __attribute__((export_name("TS_ChannelCounterparty_clone_ptr"))) TS_ChannelCounterparty_clone_ptr(uint64_t arg) {
26194         LDKChannelCounterparty arg_conv;
26195         arg_conv.inner = untag_ptr(arg);
26196         arg_conv.is_owned = ptr_is_owned(arg);
26197         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26198         arg_conv.is_owned = false;
26199         int64_t ret_conv = ChannelCounterparty_clone_ptr(&arg_conv);
26200         return ret_conv;
26201 }
26202
26203 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_clone"))) TS_ChannelCounterparty_clone(uint64_t orig) {
26204         LDKChannelCounterparty orig_conv;
26205         orig_conv.inner = untag_ptr(orig);
26206         orig_conv.is_owned = ptr_is_owned(orig);
26207         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26208         orig_conv.is_owned = false;
26209         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
26210         uint64_t ret_ref = 0;
26211         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26212         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26213         return ret_ref;
26214 }
26215
26216 void  __attribute__((export_name("TS_ChannelDetails_free"))) TS_ChannelDetails_free(uint64_t this_obj) {
26217         LDKChannelDetails this_obj_conv;
26218         this_obj_conv.inner = untag_ptr(this_obj);
26219         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26221         ChannelDetails_free(this_obj_conv);
26222 }
26223
26224 int8_tArray  __attribute__((export_name("TS_ChannelDetails_get_channel_id"))) TS_ChannelDetails_get_channel_id(uint64_t this_ptr) {
26225         LDKChannelDetails this_ptr_conv;
26226         this_ptr_conv.inner = untag_ptr(this_ptr);
26227         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26229         this_ptr_conv.is_owned = false;
26230         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26231         memcpy(ret_arr->elems, *ChannelDetails_get_channel_id(&this_ptr_conv), 32);
26232         return ret_arr;
26233 }
26234
26235 void  __attribute__((export_name("TS_ChannelDetails_set_channel_id"))) TS_ChannelDetails_set_channel_id(uint64_t this_ptr, int8_tArray val) {
26236         LDKChannelDetails this_ptr_conv;
26237         this_ptr_conv.inner = untag_ptr(this_ptr);
26238         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26239         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26240         this_ptr_conv.is_owned = false;
26241         LDKThirtyTwoBytes val_ref;
26242         CHECK(val->arr_len == 32);
26243         memcpy(val_ref.data, val->elems, 32); FREE(val);
26244         ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
26245 }
26246
26247 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_counterparty"))) TS_ChannelDetails_get_counterparty(uint64_t this_ptr) {
26248         LDKChannelDetails this_ptr_conv;
26249         this_ptr_conv.inner = untag_ptr(this_ptr);
26250         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26252         this_ptr_conv.is_owned = false;
26253         LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
26254         uint64_t ret_ref = 0;
26255         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26256         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26257         return ret_ref;
26258 }
26259
26260 void  __attribute__((export_name("TS_ChannelDetails_set_counterparty"))) TS_ChannelDetails_set_counterparty(uint64_t this_ptr, uint64_t val) {
26261         LDKChannelDetails this_ptr_conv;
26262         this_ptr_conv.inner = untag_ptr(this_ptr);
26263         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26264         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26265         this_ptr_conv.is_owned = false;
26266         LDKChannelCounterparty val_conv;
26267         val_conv.inner = untag_ptr(val);
26268         val_conv.is_owned = ptr_is_owned(val);
26269         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26270         val_conv = ChannelCounterparty_clone(&val_conv);
26271         ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
26272 }
26273
26274 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_funding_txo"))) TS_ChannelDetails_get_funding_txo(uint64_t this_ptr) {
26275         LDKChannelDetails this_ptr_conv;
26276         this_ptr_conv.inner = untag_ptr(this_ptr);
26277         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26279         this_ptr_conv.is_owned = false;
26280         LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
26281         uint64_t ret_ref = 0;
26282         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26283         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26284         return ret_ref;
26285 }
26286
26287 void  __attribute__((export_name("TS_ChannelDetails_set_funding_txo"))) TS_ChannelDetails_set_funding_txo(uint64_t this_ptr, uint64_t val) {
26288         LDKChannelDetails this_ptr_conv;
26289         this_ptr_conv.inner = untag_ptr(this_ptr);
26290         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26291         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26292         this_ptr_conv.is_owned = false;
26293         LDKOutPoint val_conv;
26294         val_conv.inner = untag_ptr(val);
26295         val_conv.is_owned = ptr_is_owned(val);
26296         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26297         val_conv = OutPoint_clone(&val_conv);
26298         ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
26299 }
26300
26301 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_channel_type"))) TS_ChannelDetails_get_channel_type(uint64_t this_ptr) {
26302         LDKChannelDetails this_ptr_conv;
26303         this_ptr_conv.inner = untag_ptr(this_ptr);
26304         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26306         this_ptr_conv.is_owned = false;
26307         LDKChannelTypeFeatures ret_var = ChannelDetails_get_channel_type(&this_ptr_conv);
26308         uint64_t ret_ref = 0;
26309         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26310         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26311         return ret_ref;
26312 }
26313
26314 void  __attribute__((export_name("TS_ChannelDetails_set_channel_type"))) TS_ChannelDetails_set_channel_type(uint64_t this_ptr, uint64_t val) {
26315         LDKChannelDetails this_ptr_conv;
26316         this_ptr_conv.inner = untag_ptr(this_ptr);
26317         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26319         this_ptr_conv.is_owned = false;
26320         LDKChannelTypeFeatures val_conv;
26321         val_conv.inner = untag_ptr(val);
26322         val_conv.is_owned = ptr_is_owned(val);
26323         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26324         val_conv = ChannelTypeFeatures_clone(&val_conv);
26325         ChannelDetails_set_channel_type(&this_ptr_conv, val_conv);
26326 }
26327
26328 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_short_channel_id"))) TS_ChannelDetails_get_short_channel_id(uint64_t this_ptr) {
26329         LDKChannelDetails this_ptr_conv;
26330         this_ptr_conv.inner = untag_ptr(this_ptr);
26331         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26333         this_ptr_conv.is_owned = false;
26334         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26335         *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
26336         uint64_t ret_ref = tag_ptr(ret_copy, true);
26337         return ret_ref;
26338 }
26339
26340 void  __attribute__((export_name("TS_ChannelDetails_set_short_channel_id"))) TS_ChannelDetails_set_short_channel_id(uint64_t this_ptr, uint64_t val) {
26341         LDKChannelDetails this_ptr_conv;
26342         this_ptr_conv.inner = untag_ptr(this_ptr);
26343         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26345         this_ptr_conv.is_owned = false;
26346         void* val_ptr = untag_ptr(val);
26347         CHECK_ACCESS(val_ptr);
26348         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
26349         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
26350         ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
26351 }
26352
26353 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_scid_alias"))) TS_ChannelDetails_get_outbound_scid_alias(uint64_t this_ptr) {
26354         LDKChannelDetails this_ptr_conv;
26355         this_ptr_conv.inner = untag_ptr(this_ptr);
26356         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26358         this_ptr_conv.is_owned = false;
26359         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26360         *ret_copy = ChannelDetails_get_outbound_scid_alias(&this_ptr_conv);
26361         uint64_t ret_ref = tag_ptr(ret_copy, true);
26362         return ret_ref;
26363 }
26364
26365 void  __attribute__((export_name("TS_ChannelDetails_set_outbound_scid_alias"))) TS_ChannelDetails_set_outbound_scid_alias(uint64_t this_ptr, uint64_t val) {
26366         LDKChannelDetails this_ptr_conv;
26367         this_ptr_conv.inner = untag_ptr(this_ptr);
26368         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26370         this_ptr_conv.is_owned = false;
26371         void* val_ptr = untag_ptr(val);
26372         CHECK_ACCESS(val_ptr);
26373         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
26374         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
26375         ChannelDetails_set_outbound_scid_alias(&this_ptr_conv, val_conv);
26376 }
26377
26378 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_scid_alias"))) TS_ChannelDetails_get_inbound_scid_alias(uint64_t this_ptr) {
26379         LDKChannelDetails this_ptr_conv;
26380         this_ptr_conv.inner = untag_ptr(this_ptr);
26381         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26383         this_ptr_conv.is_owned = false;
26384         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26385         *ret_copy = ChannelDetails_get_inbound_scid_alias(&this_ptr_conv);
26386         uint64_t ret_ref = tag_ptr(ret_copy, true);
26387         return ret_ref;
26388 }
26389
26390 void  __attribute__((export_name("TS_ChannelDetails_set_inbound_scid_alias"))) TS_ChannelDetails_set_inbound_scid_alias(uint64_t this_ptr, uint64_t val) {
26391         LDKChannelDetails this_ptr_conv;
26392         this_ptr_conv.inner = untag_ptr(this_ptr);
26393         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26395         this_ptr_conv.is_owned = false;
26396         void* val_ptr = untag_ptr(val);
26397         CHECK_ACCESS(val_ptr);
26398         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
26399         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
26400         ChannelDetails_set_inbound_scid_alias(&this_ptr_conv, val_conv);
26401 }
26402
26403 int64_t  __attribute__((export_name("TS_ChannelDetails_get_channel_value_satoshis"))) TS_ChannelDetails_get_channel_value_satoshis(uint64_t this_ptr) {
26404         LDKChannelDetails this_ptr_conv;
26405         this_ptr_conv.inner = untag_ptr(this_ptr);
26406         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26408         this_ptr_conv.is_owned = false;
26409         int64_t ret_conv = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
26410         return ret_conv;
26411 }
26412
26413 void  __attribute__((export_name("TS_ChannelDetails_set_channel_value_satoshis"))) TS_ChannelDetails_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
26414         LDKChannelDetails this_ptr_conv;
26415         this_ptr_conv.inner = untag_ptr(this_ptr);
26416         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26417         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26418         this_ptr_conv.is_owned = false;
26419         ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
26420 }
26421
26422 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_unspendable_punishment_reserve"))) TS_ChannelDetails_get_unspendable_punishment_reserve(uint64_t this_ptr) {
26423         LDKChannelDetails this_ptr_conv;
26424         this_ptr_conv.inner = untag_ptr(this_ptr);
26425         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26427         this_ptr_conv.is_owned = false;
26428         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26429         *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
26430         uint64_t ret_ref = tag_ptr(ret_copy, true);
26431         return ret_ref;
26432 }
26433
26434 void  __attribute__((export_name("TS_ChannelDetails_set_unspendable_punishment_reserve"))) TS_ChannelDetails_set_unspendable_punishment_reserve(uint64_t this_ptr, uint64_t val) {
26435         LDKChannelDetails this_ptr_conv;
26436         this_ptr_conv.inner = untag_ptr(this_ptr);
26437         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26439         this_ptr_conv.is_owned = false;
26440         void* val_ptr = untag_ptr(val);
26441         CHECK_ACCESS(val_ptr);
26442         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
26443         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
26444         ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
26445 }
26446
26447 int64_t  __attribute__((export_name("TS_ChannelDetails_get_user_channel_id"))) TS_ChannelDetails_get_user_channel_id(uint64_t this_ptr) {
26448         LDKChannelDetails this_ptr_conv;
26449         this_ptr_conv.inner = untag_ptr(this_ptr);
26450         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26452         this_ptr_conv.is_owned = false;
26453         int64_t ret_conv = ChannelDetails_get_user_channel_id(&this_ptr_conv);
26454         return ret_conv;
26455 }
26456
26457 void  __attribute__((export_name("TS_ChannelDetails_set_user_channel_id"))) TS_ChannelDetails_set_user_channel_id(uint64_t this_ptr, int64_t val) {
26458         LDKChannelDetails this_ptr_conv;
26459         this_ptr_conv.inner = untag_ptr(this_ptr);
26460         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26462         this_ptr_conv.is_owned = false;
26463         ChannelDetails_set_user_channel_id(&this_ptr_conv, val);
26464 }
26465
26466 int64_t  __attribute__((export_name("TS_ChannelDetails_get_balance_msat"))) TS_ChannelDetails_get_balance_msat(uint64_t this_ptr) {
26467         LDKChannelDetails this_ptr_conv;
26468         this_ptr_conv.inner = untag_ptr(this_ptr);
26469         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26471         this_ptr_conv.is_owned = false;
26472         int64_t ret_conv = ChannelDetails_get_balance_msat(&this_ptr_conv);
26473         return ret_conv;
26474 }
26475
26476 void  __attribute__((export_name("TS_ChannelDetails_set_balance_msat"))) TS_ChannelDetails_set_balance_msat(uint64_t this_ptr, int64_t val) {
26477         LDKChannelDetails this_ptr_conv;
26478         this_ptr_conv.inner = untag_ptr(this_ptr);
26479         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26481         this_ptr_conv.is_owned = false;
26482         ChannelDetails_set_balance_msat(&this_ptr_conv, val);
26483 }
26484
26485 int64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_capacity_msat"))) TS_ChannelDetails_get_outbound_capacity_msat(uint64_t this_ptr) {
26486         LDKChannelDetails this_ptr_conv;
26487         this_ptr_conv.inner = untag_ptr(this_ptr);
26488         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26490         this_ptr_conv.is_owned = false;
26491         int64_t ret_conv = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
26492         return ret_conv;
26493 }
26494
26495 void  __attribute__((export_name("TS_ChannelDetails_set_outbound_capacity_msat"))) TS_ChannelDetails_set_outbound_capacity_msat(uint64_t this_ptr, int64_t val) {
26496         LDKChannelDetails this_ptr_conv;
26497         this_ptr_conv.inner = untag_ptr(this_ptr);
26498         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26500         this_ptr_conv.is_owned = false;
26501         ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
26502 }
26503
26504 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) {
26505         LDKChannelDetails this_ptr_conv;
26506         this_ptr_conv.inner = untag_ptr(this_ptr);
26507         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26508         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26509         this_ptr_conv.is_owned = false;
26510         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_limit_msat(&this_ptr_conv);
26511         return ret_conv;
26512 }
26513
26514 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) {
26515         LDKChannelDetails this_ptr_conv;
26516         this_ptr_conv.inner = untag_ptr(this_ptr);
26517         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26518         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26519         this_ptr_conv.is_owned = false;
26520         ChannelDetails_set_next_outbound_htlc_limit_msat(&this_ptr_conv, val);
26521 }
26522
26523 int64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_capacity_msat"))) TS_ChannelDetails_get_inbound_capacity_msat(uint64_t this_ptr) {
26524         LDKChannelDetails this_ptr_conv;
26525         this_ptr_conv.inner = untag_ptr(this_ptr);
26526         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26528         this_ptr_conv.is_owned = false;
26529         int64_t ret_conv = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
26530         return ret_conv;
26531 }
26532
26533 void  __attribute__((export_name("TS_ChannelDetails_set_inbound_capacity_msat"))) TS_ChannelDetails_set_inbound_capacity_msat(uint64_t this_ptr, int64_t val) {
26534         LDKChannelDetails this_ptr_conv;
26535         this_ptr_conv.inner = untag_ptr(this_ptr);
26536         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26538         this_ptr_conv.is_owned = false;
26539         ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
26540 }
26541
26542 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_confirmations_required"))) TS_ChannelDetails_get_confirmations_required(uint64_t this_ptr) {
26543         LDKChannelDetails this_ptr_conv;
26544         this_ptr_conv.inner = untag_ptr(this_ptr);
26545         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26547         this_ptr_conv.is_owned = false;
26548         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
26549         *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
26550         uint64_t ret_ref = tag_ptr(ret_copy, true);
26551         return ret_ref;
26552 }
26553
26554 void  __attribute__((export_name("TS_ChannelDetails_set_confirmations_required"))) TS_ChannelDetails_set_confirmations_required(uint64_t this_ptr, uint64_t val) {
26555         LDKChannelDetails this_ptr_conv;
26556         this_ptr_conv.inner = untag_ptr(this_ptr);
26557         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26559         this_ptr_conv.is_owned = false;
26560         void* val_ptr = untag_ptr(val);
26561         CHECK_ACCESS(val_ptr);
26562         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
26563         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
26564         ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
26565 }
26566
26567 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_force_close_spend_delay"))) TS_ChannelDetails_get_force_close_spend_delay(uint64_t this_ptr) {
26568         LDKChannelDetails this_ptr_conv;
26569         this_ptr_conv.inner = untag_ptr(this_ptr);
26570         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26572         this_ptr_conv.is_owned = false;
26573         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
26574         *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
26575         uint64_t ret_ref = tag_ptr(ret_copy, true);
26576         return ret_ref;
26577 }
26578
26579 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) {
26580         LDKChannelDetails this_ptr_conv;
26581         this_ptr_conv.inner = untag_ptr(this_ptr);
26582         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26584         this_ptr_conv.is_owned = false;
26585         void* val_ptr = untag_ptr(val);
26586         CHECK_ACCESS(val_ptr);
26587         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
26588         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
26589         ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
26590 }
26591
26592 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_outbound"))) TS_ChannelDetails_get_is_outbound(uint64_t this_ptr) {
26593         LDKChannelDetails this_ptr_conv;
26594         this_ptr_conv.inner = untag_ptr(this_ptr);
26595         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26597         this_ptr_conv.is_owned = false;
26598         jboolean ret_conv = ChannelDetails_get_is_outbound(&this_ptr_conv);
26599         return ret_conv;
26600 }
26601
26602 void  __attribute__((export_name("TS_ChannelDetails_set_is_outbound"))) TS_ChannelDetails_set_is_outbound(uint64_t this_ptr, jboolean val) {
26603         LDKChannelDetails this_ptr_conv;
26604         this_ptr_conv.inner = untag_ptr(this_ptr);
26605         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26607         this_ptr_conv.is_owned = false;
26608         ChannelDetails_set_is_outbound(&this_ptr_conv, val);
26609 }
26610
26611 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_channel_ready"))) TS_ChannelDetails_get_is_channel_ready(uint64_t this_ptr) {
26612         LDKChannelDetails this_ptr_conv;
26613         this_ptr_conv.inner = untag_ptr(this_ptr);
26614         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26616         this_ptr_conv.is_owned = false;
26617         jboolean ret_conv = ChannelDetails_get_is_channel_ready(&this_ptr_conv);
26618         return ret_conv;
26619 }
26620
26621 void  __attribute__((export_name("TS_ChannelDetails_set_is_channel_ready"))) TS_ChannelDetails_set_is_channel_ready(uint64_t this_ptr, jboolean val) {
26622         LDKChannelDetails this_ptr_conv;
26623         this_ptr_conv.inner = untag_ptr(this_ptr);
26624         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26626         this_ptr_conv.is_owned = false;
26627         ChannelDetails_set_is_channel_ready(&this_ptr_conv, val);
26628 }
26629
26630 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_usable"))) TS_ChannelDetails_get_is_usable(uint64_t this_ptr) {
26631         LDKChannelDetails this_ptr_conv;
26632         this_ptr_conv.inner = untag_ptr(this_ptr);
26633         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26635         this_ptr_conv.is_owned = false;
26636         jboolean ret_conv = ChannelDetails_get_is_usable(&this_ptr_conv);
26637         return ret_conv;
26638 }
26639
26640 void  __attribute__((export_name("TS_ChannelDetails_set_is_usable"))) TS_ChannelDetails_set_is_usable(uint64_t this_ptr, jboolean val) {
26641         LDKChannelDetails this_ptr_conv;
26642         this_ptr_conv.inner = untag_ptr(this_ptr);
26643         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26645         this_ptr_conv.is_owned = false;
26646         ChannelDetails_set_is_usable(&this_ptr_conv, val);
26647 }
26648
26649 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_public"))) TS_ChannelDetails_get_is_public(uint64_t this_ptr) {
26650         LDKChannelDetails this_ptr_conv;
26651         this_ptr_conv.inner = untag_ptr(this_ptr);
26652         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26654         this_ptr_conv.is_owned = false;
26655         jboolean ret_conv = ChannelDetails_get_is_public(&this_ptr_conv);
26656         return ret_conv;
26657 }
26658
26659 void  __attribute__((export_name("TS_ChannelDetails_set_is_public"))) TS_ChannelDetails_set_is_public(uint64_t this_ptr, jboolean val) {
26660         LDKChannelDetails this_ptr_conv;
26661         this_ptr_conv.inner = untag_ptr(this_ptr);
26662         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26664         this_ptr_conv.is_owned = false;
26665         ChannelDetails_set_is_public(&this_ptr_conv, val);
26666 }
26667
26668 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_htlc_minimum_msat"))) TS_ChannelDetails_get_inbound_htlc_minimum_msat(uint64_t this_ptr) {
26669         LDKChannelDetails this_ptr_conv;
26670         this_ptr_conv.inner = untag_ptr(this_ptr);
26671         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26673         this_ptr_conv.is_owned = false;
26674         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26675         *ret_copy = ChannelDetails_get_inbound_htlc_minimum_msat(&this_ptr_conv);
26676         uint64_t ret_ref = tag_ptr(ret_copy, true);
26677         return ret_ref;
26678 }
26679
26680 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) {
26681         LDKChannelDetails this_ptr_conv;
26682         this_ptr_conv.inner = untag_ptr(this_ptr);
26683         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26685         this_ptr_conv.is_owned = false;
26686         void* val_ptr = untag_ptr(val);
26687         CHECK_ACCESS(val_ptr);
26688         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
26689         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
26690         ChannelDetails_set_inbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
26691 }
26692
26693 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_htlc_maximum_msat"))) TS_ChannelDetails_get_inbound_htlc_maximum_msat(uint64_t this_ptr) {
26694         LDKChannelDetails this_ptr_conv;
26695         this_ptr_conv.inner = untag_ptr(this_ptr);
26696         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26698         this_ptr_conv.is_owned = false;
26699         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26700         *ret_copy = ChannelDetails_get_inbound_htlc_maximum_msat(&this_ptr_conv);
26701         uint64_t ret_ref = tag_ptr(ret_copy, true);
26702         return ret_ref;
26703 }
26704
26705 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) {
26706         LDKChannelDetails this_ptr_conv;
26707         this_ptr_conv.inner = untag_ptr(this_ptr);
26708         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26710         this_ptr_conv.is_owned = false;
26711         void* val_ptr = untag_ptr(val);
26712         CHECK_ACCESS(val_ptr);
26713         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
26714         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
26715         ChannelDetails_set_inbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
26716 }
26717
26718 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_config"))) TS_ChannelDetails_get_config(uint64_t this_ptr) {
26719         LDKChannelDetails this_ptr_conv;
26720         this_ptr_conv.inner = untag_ptr(this_ptr);
26721         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26723         this_ptr_conv.is_owned = false;
26724         LDKChannelConfig ret_var = ChannelDetails_get_config(&this_ptr_conv);
26725         uint64_t ret_ref = 0;
26726         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26727         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26728         return ret_ref;
26729 }
26730
26731 void  __attribute__((export_name("TS_ChannelDetails_set_config"))) TS_ChannelDetails_set_config(uint64_t this_ptr, uint64_t val) {
26732         LDKChannelDetails this_ptr_conv;
26733         this_ptr_conv.inner = untag_ptr(this_ptr);
26734         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26736         this_ptr_conv.is_owned = false;
26737         LDKChannelConfig val_conv;
26738         val_conv.inner = untag_ptr(val);
26739         val_conv.is_owned = ptr_is_owned(val);
26740         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26741         val_conv = ChannelConfig_clone(&val_conv);
26742         ChannelDetails_set_config(&this_ptr_conv, val_conv);
26743 }
26744
26745 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) {
26746         LDKThirtyTwoBytes channel_id_arg_ref;
26747         CHECK(channel_id_arg->arr_len == 32);
26748         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
26749         LDKChannelCounterparty counterparty_arg_conv;
26750         counterparty_arg_conv.inner = untag_ptr(counterparty_arg);
26751         counterparty_arg_conv.is_owned = ptr_is_owned(counterparty_arg);
26752         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_arg_conv);
26753         counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
26754         LDKOutPoint funding_txo_arg_conv;
26755         funding_txo_arg_conv.inner = untag_ptr(funding_txo_arg);
26756         funding_txo_arg_conv.is_owned = ptr_is_owned(funding_txo_arg);
26757         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv);
26758         funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
26759         LDKChannelTypeFeatures channel_type_arg_conv;
26760         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
26761         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
26762         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
26763         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
26764         void* short_channel_id_arg_ptr = untag_ptr(short_channel_id_arg);
26765         CHECK_ACCESS(short_channel_id_arg_ptr);
26766         LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
26767         short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_arg));
26768         void* outbound_scid_alias_arg_ptr = untag_ptr(outbound_scid_alias_arg);
26769         CHECK_ACCESS(outbound_scid_alias_arg_ptr);
26770         LDKCOption_u64Z outbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(outbound_scid_alias_arg_ptr);
26771         outbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_scid_alias_arg));
26772         void* inbound_scid_alias_arg_ptr = untag_ptr(inbound_scid_alias_arg);
26773         CHECK_ACCESS(inbound_scid_alias_arg_ptr);
26774         LDKCOption_u64Z inbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(inbound_scid_alias_arg_ptr);
26775         inbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_scid_alias_arg));
26776         void* unspendable_punishment_reserve_arg_ptr = untag_ptr(unspendable_punishment_reserve_arg);
26777         CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
26778         LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
26779         void* confirmations_required_arg_ptr = untag_ptr(confirmations_required_arg);
26780         CHECK_ACCESS(confirmations_required_arg_ptr);
26781         LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
26782         confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_required_arg));
26783         void* force_close_spend_delay_arg_ptr = untag_ptr(force_close_spend_delay_arg);
26784         CHECK_ACCESS(force_close_spend_delay_arg_ptr);
26785         LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
26786         force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(force_close_spend_delay_arg));
26787         void* inbound_htlc_minimum_msat_arg_ptr = untag_ptr(inbound_htlc_minimum_msat_arg);
26788         CHECK_ACCESS(inbound_htlc_minimum_msat_arg_ptr);
26789         LDKCOption_u64Z inbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_minimum_msat_arg_ptr);
26790         inbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_minimum_msat_arg));
26791         void* inbound_htlc_maximum_msat_arg_ptr = untag_ptr(inbound_htlc_maximum_msat_arg);
26792         CHECK_ACCESS(inbound_htlc_maximum_msat_arg_ptr);
26793         LDKCOption_u64Z inbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_maximum_msat_arg_ptr);
26794         inbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_maximum_msat_arg));
26795         LDKChannelConfig config_arg_conv;
26796         config_arg_conv.inner = untag_ptr(config_arg);
26797         config_arg_conv.is_owned = ptr_is_owned(config_arg);
26798         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_arg_conv);
26799         config_arg_conv = ChannelConfig_clone(&config_arg_conv);
26800         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);
26801         uint64_t ret_ref = 0;
26802         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26803         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26804         return ret_ref;
26805 }
26806
26807 static inline uint64_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
26808         LDKChannelDetails ret_var = ChannelDetails_clone(arg);
26809         uint64_t ret_ref = 0;
26810         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26811         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26812         return ret_ref;
26813 }
26814 int64_t  __attribute__((export_name("TS_ChannelDetails_clone_ptr"))) TS_ChannelDetails_clone_ptr(uint64_t arg) {
26815         LDKChannelDetails arg_conv;
26816         arg_conv.inner = untag_ptr(arg);
26817         arg_conv.is_owned = ptr_is_owned(arg);
26818         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26819         arg_conv.is_owned = false;
26820         int64_t ret_conv = ChannelDetails_clone_ptr(&arg_conv);
26821         return ret_conv;
26822 }
26823
26824 uint64_t  __attribute__((export_name("TS_ChannelDetails_clone"))) TS_ChannelDetails_clone(uint64_t orig) {
26825         LDKChannelDetails orig_conv;
26826         orig_conv.inner = untag_ptr(orig);
26827         orig_conv.is_owned = ptr_is_owned(orig);
26828         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26829         orig_conv.is_owned = false;
26830         LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
26831         uint64_t ret_ref = 0;
26832         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26833         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26834         return ret_ref;
26835 }
26836
26837 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_payment_scid"))) TS_ChannelDetails_get_inbound_payment_scid(uint64_t this_arg) {
26838         LDKChannelDetails this_arg_conv;
26839         this_arg_conv.inner = untag_ptr(this_arg);
26840         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26842         this_arg_conv.is_owned = false;
26843         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26844         *ret_copy = ChannelDetails_get_inbound_payment_scid(&this_arg_conv);
26845         uint64_t ret_ref = tag_ptr(ret_copy, true);
26846         return ret_ref;
26847 }
26848
26849 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_payment_scid"))) TS_ChannelDetails_get_outbound_payment_scid(uint64_t this_arg) {
26850         LDKChannelDetails this_arg_conv;
26851         this_arg_conv.inner = untag_ptr(this_arg);
26852         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26854         this_arg_conv.is_owned = false;
26855         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26856         *ret_copy = ChannelDetails_get_outbound_payment_scid(&this_arg_conv);
26857         uint64_t ret_ref = tag_ptr(ret_copy, true);
26858         return ret_ref;
26859 }
26860
26861 void  __attribute__((export_name("TS_PaymentSendFailure_free"))) TS_PaymentSendFailure_free(uint64_t this_ptr) {
26862         if (!ptr_is_owned(this_ptr)) return;
26863         void* this_ptr_ptr = untag_ptr(this_ptr);
26864         CHECK_ACCESS(this_ptr_ptr);
26865         LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
26866         FREE(untag_ptr(this_ptr));
26867         PaymentSendFailure_free(this_ptr_conv);
26868 }
26869
26870 static inline uint64_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
26871         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
26872         *ret_copy = PaymentSendFailure_clone(arg);
26873         uint64_t ret_ref = tag_ptr(ret_copy, true);
26874         return ret_ref;
26875 }
26876 int64_t  __attribute__((export_name("TS_PaymentSendFailure_clone_ptr"))) TS_PaymentSendFailure_clone_ptr(uint64_t arg) {
26877         LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)untag_ptr(arg);
26878         int64_t ret_conv = PaymentSendFailure_clone_ptr(arg_conv);
26879         return ret_conv;
26880 }
26881
26882 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_clone"))) TS_PaymentSendFailure_clone(uint64_t orig) {
26883         LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)untag_ptr(orig);
26884         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
26885         *ret_copy = PaymentSendFailure_clone(orig_conv);
26886         uint64_t ret_ref = tag_ptr(ret_copy, true);
26887         return ret_ref;
26888 }
26889
26890 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_parameter_error"))) TS_PaymentSendFailure_parameter_error(uint64_t a) {
26891         void* a_ptr = untag_ptr(a);
26892         CHECK_ACCESS(a_ptr);
26893         LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
26894         a_conv = APIError_clone((LDKAPIError*)untag_ptr(a));
26895         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
26896         *ret_copy = PaymentSendFailure_parameter_error(a_conv);
26897         uint64_t ret_ref = tag_ptr(ret_copy, true);
26898         return ret_ref;
26899 }
26900
26901 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_path_parameter_error"))) TS_PaymentSendFailure_path_parameter_error(uint64_tArray a) {
26902         LDKCVec_CResult_NoneAPIErrorZZ a_constr;
26903         a_constr.datalen = a->arr_len;
26904         if (a_constr.datalen > 0)
26905                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
26906         else
26907                 a_constr.data = NULL;
26908         uint64_t* a_vals = a->elems;
26909         for (size_t w = 0; w < a_constr.datalen; w++) {
26910                 uint64_t a_conv_22 = a_vals[w];
26911                 void* a_conv_22_ptr = untag_ptr(a_conv_22);
26912                 CHECK_ACCESS(a_conv_22_ptr);
26913                 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
26914                 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)untag_ptr(a_conv_22));
26915                 a_constr.data[w] = a_conv_22_conv;
26916         }
26917         FREE(a);
26918         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
26919         *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
26920         uint64_t ret_ref = tag_ptr(ret_copy, true);
26921         return ret_ref;
26922 }
26923
26924 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_all_failed_retry_safe"))) TS_PaymentSendFailure_all_failed_retry_safe(uint64_tArray a) {
26925         LDKCVec_APIErrorZ a_constr;
26926         a_constr.datalen = a->arr_len;
26927         if (a_constr.datalen > 0)
26928                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
26929         else
26930                 a_constr.data = NULL;
26931         uint64_t* a_vals = a->elems;
26932         for (size_t k = 0; k < a_constr.datalen; k++) {
26933                 uint64_t a_conv_10 = a_vals[k];
26934                 void* a_conv_10_ptr = untag_ptr(a_conv_10);
26935                 CHECK_ACCESS(a_conv_10_ptr);
26936                 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
26937                 a_conv_10_conv = APIError_clone((LDKAPIError*)untag_ptr(a_conv_10));
26938                 a_constr.data[k] = a_conv_10_conv;
26939         }
26940         FREE(a);
26941         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
26942         *ret_copy = PaymentSendFailure_all_failed_retry_safe(a_constr);
26943         uint64_t ret_ref = tag_ptr(ret_copy, true);
26944         return ret_ref;
26945 }
26946
26947 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) {
26948         LDKCVec_CResult_NoneAPIErrorZZ results_constr;
26949         results_constr.datalen = results->arr_len;
26950         if (results_constr.datalen > 0)
26951                 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
26952         else
26953                 results_constr.data = NULL;
26954         uint64_t* results_vals = results->elems;
26955         for (size_t w = 0; w < results_constr.datalen; w++) {
26956                 uint64_t results_conv_22 = results_vals[w];
26957                 void* results_conv_22_ptr = untag_ptr(results_conv_22);
26958                 CHECK_ACCESS(results_conv_22_ptr);
26959                 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
26960                 results_constr.data[w] = results_conv_22_conv;
26961         }
26962         FREE(results);
26963         LDKRouteParameters failed_paths_retry_conv;
26964         failed_paths_retry_conv.inner = untag_ptr(failed_paths_retry);
26965         failed_paths_retry_conv.is_owned = ptr_is_owned(failed_paths_retry);
26966         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
26967         failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
26968         LDKThirtyTwoBytes payment_id_ref;
26969         CHECK(payment_id->arr_len == 32);
26970         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
26971         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
26972         *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
26973         uint64_t ret_ref = tag_ptr(ret_copy, true);
26974         return ret_ref;
26975 }
26976
26977 void  __attribute__((export_name("TS_PhantomRouteHints_free"))) TS_PhantomRouteHints_free(uint64_t this_obj) {
26978         LDKPhantomRouteHints this_obj_conv;
26979         this_obj_conv.inner = untag_ptr(this_obj);
26980         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26982         PhantomRouteHints_free(this_obj_conv);
26983 }
26984
26985 uint64_tArray  __attribute__((export_name("TS_PhantomRouteHints_get_channels"))) TS_PhantomRouteHints_get_channels(uint64_t this_ptr) {
26986         LDKPhantomRouteHints this_ptr_conv;
26987         this_ptr_conv.inner = untag_ptr(this_ptr);
26988         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26990         this_ptr_conv.is_owned = false;
26991         LDKCVec_ChannelDetailsZ ret_var = PhantomRouteHints_get_channels(&this_ptr_conv);
26992         uint64_tArray ret_arr = NULL;
26993         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
26994         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
26995         for (size_t q = 0; q < ret_var.datalen; q++) {
26996                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
26997                 uint64_t ret_conv_16_ref = 0;
26998                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
26999                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
27000                 ret_arr_ptr[q] = ret_conv_16_ref;
27001         }
27002         
27003         FREE(ret_var.data);
27004         return ret_arr;
27005 }
27006
27007 void  __attribute__((export_name("TS_PhantomRouteHints_set_channels"))) TS_PhantomRouteHints_set_channels(uint64_t this_ptr, uint64_tArray val) {
27008         LDKPhantomRouteHints this_ptr_conv;
27009         this_ptr_conv.inner = untag_ptr(this_ptr);
27010         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27012         this_ptr_conv.is_owned = false;
27013         LDKCVec_ChannelDetailsZ val_constr;
27014         val_constr.datalen = val->arr_len;
27015         if (val_constr.datalen > 0)
27016                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
27017         else
27018                 val_constr.data = NULL;
27019         uint64_t* val_vals = val->elems;
27020         for (size_t q = 0; q < val_constr.datalen; q++) {
27021                 uint64_t val_conv_16 = val_vals[q];
27022                 LDKChannelDetails val_conv_16_conv;
27023                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
27024                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
27025                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
27026                 val_conv_16_conv = ChannelDetails_clone(&val_conv_16_conv);
27027                 val_constr.data[q] = val_conv_16_conv;
27028         }
27029         FREE(val);
27030         PhantomRouteHints_set_channels(&this_ptr_conv, val_constr);
27031 }
27032
27033 int64_t  __attribute__((export_name("TS_PhantomRouteHints_get_phantom_scid"))) TS_PhantomRouteHints_get_phantom_scid(uint64_t this_ptr) {
27034         LDKPhantomRouteHints this_ptr_conv;
27035         this_ptr_conv.inner = untag_ptr(this_ptr);
27036         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27038         this_ptr_conv.is_owned = false;
27039         int64_t ret_conv = PhantomRouteHints_get_phantom_scid(&this_ptr_conv);
27040         return ret_conv;
27041 }
27042
27043 void  __attribute__((export_name("TS_PhantomRouteHints_set_phantom_scid"))) TS_PhantomRouteHints_set_phantom_scid(uint64_t this_ptr, int64_t val) {
27044         LDKPhantomRouteHints this_ptr_conv;
27045         this_ptr_conv.inner = untag_ptr(this_ptr);
27046         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27048         this_ptr_conv.is_owned = false;
27049         PhantomRouteHints_set_phantom_scid(&this_ptr_conv, val);
27050 }
27051
27052 int8_tArray  __attribute__((export_name("TS_PhantomRouteHints_get_real_node_pubkey"))) TS_PhantomRouteHints_get_real_node_pubkey(uint64_t this_ptr) {
27053         LDKPhantomRouteHints this_ptr_conv;
27054         this_ptr_conv.inner = untag_ptr(this_ptr);
27055         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27057         this_ptr_conv.is_owned = false;
27058         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
27059         memcpy(ret_arr->elems, PhantomRouteHints_get_real_node_pubkey(&this_ptr_conv).compressed_form, 33);
27060         return ret_arr;
27061 }
27062
27063 void  __attribute__((export_name("TS_PhantomRouteHints_set_real_node_pubkey"))) TS_PhantomRouteHints_set_real_node_pubkey(uint64_t this_ptr, int8_tArray val) {
27064         LDKPhantomRouteHints this_ptr_conv;
27065         this_ptr_conv.inner = untag_ptr(this_ptr);
27066         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27068         this_ptr_conv.is_owned = false;
27069         LDKPublicKey val_ref;
27070         CHECK(val->arr_len == 33);
27071         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
27072         PhantomRouteHints_set_real_node_pubkey(&this_ptr_conv, val_ref);
27073 }
27074
27075 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) {
27076         LDKCVec_ChannelDetailsZ channels_arg_constr;
27077         channels_arg_constr.datalen = channels_arg->arr_len;
27078         if (channels_arg_constr.datalen > 0)
27079                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
27080         else
27081                 channels_arg_constr.data = NULL;
27082         uint64_t* channels_arg_vals = channels_arg->elems;
27083         for (size_t q = 0; q < channels_arg_constr.datalen; q++) {
27084                 uint64_t channels_arg_conv_16 = channels_arg_vals[q];
27085                 LDKChannelDetails channels_arg_conv_16_conv;
27086                 channels_arg_conv_16_conv.inner = untag_ptr(channels_arg_conv_16);
27087                 channels_arg_conv_16_conv.is_owned = ptr_is_owned(channels_arg_conv_16);
27088                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channels_arg_conv_16_conv);
27089                 channels_arg_conv_16_conv = ChannelDetails_clone(&channels_arg_conv_16_conv);
27090                 channels_arg_constr.data[q] = channels_arg_conv_16_conv;
27091         }
27092         FREE(channels_arg);
27093         LDKPublicKey real_node_pubkey_arg_ref;
27094         CHECK(real_node_pubkey_arg->arr_len == 33);
27095         memcpy(real_node_pubkey_arg_ref.compressed_form, real_node_pubkey_arg->elems, 33); FREE(real_node_pubkey_arg);
27096         LDKPhantomRouteHints ret_var = PhantomRouteHints_new(channels_arg_constr, phantom_scid_arg, real_node_pubkey_arg_ref);
27097         uint64_t ret_ref = 0;
27098         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27099         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27100         return ret_ref;
27101 }
27102
27103 static inline uint64_t PhantomRouteHints_clone_ptr(LDKPhantomRouteHints *NONNULL_PTR arg) {
27104         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(arg);
27105         uint64_t ret_ref = 0;
27106         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27107         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27108         return ret_ref;
27109 }
27110 int64_t  __attribute__((export_name("TS_PhantomRouteHints_clone_ptr"))) TS_PhantomRouteHints_clone_ptr(uint64_t arg) {
27111         LDKPhantomRouteHints arg_conv;
27112         arg_conv.inner = untag_ptr(arg);
27113         arg_conv.is_owned = ptr_is_owned(arg);
27114         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27115         arg_conv.is_owned = false;
27116         int64_t ret_conv = PhantomRouteHints_clone_ptr(&arg_conv);
27117         return ret_conv;
27118 }
27119
27120 uint64_t  __attribute__((export_name("TS_PhantomRouteHints_clone"))) TS_PhantomRouteHints_clone(uint64_t orig) {
27121         LDKPhantomRouteHints orig_conv;
27122         orig_conv.inner = untag_ptr(orig);
27123         orig_conv.is_owned = ptr_is_owned(orig);
27124         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27125         orig_conv.is_owned = false;
27126         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(&orig_conv);
27127         uint64_t ret_ref = 0;
27128         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27129         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27130         return ret_ref;
27131 }
27132
27133 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) {
27134         void* fee_est_ptr = untag_ptr(fee_est);
27135         CHECK_ACCESS(fee_est_ptr);
27136         LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
27137         if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
27138                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27139                 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
27140         }
27141         void* chain_monitor_ptr = untag_ptr(chain_monitor);
27142         CHECK_ACCESS(chain_monitor_ptr);
27143         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
27144         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
27145                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27146                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
27147         }
27148         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
27149         CHECK_ACCESS(tx_broadcaster_ptr);
27150         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
27151         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
27152                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27153                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
27154         }
27155         void* logger_ptr = untag_ptr(logger);
27156         CHECK_ACCESS(logger_ptr);
27157         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
27158         if (logger_conv.free == LDKLogger_JCalls_free) {
27159                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27160                 LDKLogger_JCalls_cloned(&logger_conv);
27161         }
27162         void* keys_manager_ptr = untag_ptr(keys_manager);
27163         CHECK_ACCESS(keys_manager_ptr);
27164         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
27165         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
27166                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27167                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
27168         }
27169         LDKUserConfig config_conv;
27170         config_conv.inner = untag_ptr(config);
27171         config_conv.is_owned = ptr_is_owned(config);
27172         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
27173         config_conv = UserConfig_clone(&config_conv);
27174         LDKChainParameters params_conv;
27175         params_conv.inner = untag_ptr(params);
27176         params_conv.is_owned = ptr_is_owned(params);
27177         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
27178         params_conv = ChainParameters_clone(&params_conv);
27179         LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
27180         uint64_t ret_ref = 0;
27181         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27182         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27183         return ret_ref;
27184 }
27185
27186 uint64_t  __attribute__((export_name("TS_ChannelManager_get_current_default_configuration"))) TS_ChannelManager_get_current_default_configuration(uint64_t this_arg) {
27187         LDKChannelManager this_arg_conv;
27188         this_arg_conv.inner = untag_ptr(this_arg);
27189         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27191         this_arg_conv.is_owned = false;
27192         LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
27193         uint64_t ret_ref = 0;
27194         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27195         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27196         return ret_ref;
27197 }
27198
27199 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) {
27200         LDKChannelManager this_arg_conv;
27201         this_arg_conv.inner = untag_ptr(this_arg);
27202         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27204         this_arg_conv.is_owned = false;
27205         LDKPublicKey their_network_key_ref;
27206         CHECK(their_network_key->arr_len == 33);
27207         memcpy(their_network_key_ref.compressed_form, their_network_key->elems, 33); FREE(their_network_key);
27208         LDKUserConfig override_config_conv;
27209         override_config_conv.inner = untag_ptr(override_config);
27210         override_config_conv.is_owned = ptr_is_owned(override_config);
27211         CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
27212         override_config_conv = UserConfig_clone(&override_config_conv);
27213         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
27214         *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id, override_config_conv);
27215         return tag_ptr(ret_conv, true);
27216 }
27217
27218 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_channels"))) TS_ChannelManager_list_channels(uint64_t this_arg) {
27219         LDKChannelManager this_arg_conv;
27220         this_arg_conv.inner = untag_ptr(this_arg);
27221         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27223         this_arg_conv.is_owned = false;
27224         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
27225         uint64_tArray ret_arr = NULL;
27226         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
27227         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
27228         for (size_t q = 0; q < ret_var.datalen; q++) {
27229                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
27230                 uint64_t ret_conv_16_ref = 0;
27231                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
27232                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
27233                 ret_arr_ptr[q] = ret_conv_16_ref;
27234         }
27235         
27236         FREE(ret_var.data);
27237         return ret_arr;
27238 }
27239
27240 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_usable_channels"))) TS_ChannelManager_list_usable_channels(uint64_t this_arg) {
27241         LDKChannelManager this_arg_conv;
27242         this_arg_conv.inner = untag_ptr(this_arg);
27243         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27245         this_arg_conv.is_owned = false;
27246         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
27247         uint64_tArray ret_arr = NULL;
27248         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
27249         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
27250         for (size_t q = 0; q < ret_var.datalen; q++) {
27251                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
27252                 uint64_t ret_conv_16_ref = 0;
27253                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
27254                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
27255                 ret_arr_ptr[q] = ret_conv_16_ref;
27256         }
27257         
27258         FREE(ret_var.data);
27259         return ret_arr;
27260 }
27261
27262 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) {
27263         LDKChannelManager this_arg_conv;
27264         this_arg_conv.inner = untag_ptr(this_arg);
27265         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27267         this_arg_conv.is_owned = false;
27268         unsigned char channel_id_arr[32];
27269         CHECK(channel_id->arr_len == 32);
27270         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
27271         unsigned char (*channel_id_ref)[32] = &channel_id_arr;
27272         LDKPublicKey counterparty_node_id_ref;
27273         CHECK(counterparty_node_id->arr_len == 33);
27274         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
27275         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
27276         *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
27277         return tag_ptr(ret_conv, true);
27278 }
27279
27280 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) {
27281         LDKChannelManager this_arg_conv;
27282         this_arg_conv.inner = untag_ptr(this_arg);
27283         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27285         this_arg_conv.is_owned = false;
27286         unsigned char channel_id_arr[32];
27287         CHECK(channel_id->arr_len == 32);
27288         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
27289         unsigned char (*channel_id_ref)[32] = &channel_id_arr;
27290         LDKPublicKey counterparty_node_id_ref;
27291         CHECK(counterparty_node_id->arr_len == 33);
27292         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
27293         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
27294         *ret_conv = ChannelManager_close_channel_with_target_feerate(&this_arg_conv, channel_id_ref, counterparty_node_id_ref, target_feerate_sats_per_1000_weight);
27295         return tag_ptr(ret_conv, true);
27296 }
27297
27298 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) {
27299         LDKChannelManager this_arg_conv;
27300         this_arg_conv.inner = untag_ptr(this_arg);
27301         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27303         this_arg_conv.is_owned = false;
27304         unsigned char channel_id_arr[32];
27305         CHECK(channel_id->arr_len == 32);
27306         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
27307         unsigned char (*channel_id_ref)[32] = &channel_id_arr;
27308         LDKPublicKey counterparty_node_id_ref;
27309         CHECK(counterparty_node_id->arr_len == 33);
27310         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
27311         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
27312         *ret_conv = ChannelManager_force_close_broadcasting_latest_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
27313         return tag_ptr(ret_conv, true);
27314 }
27315
27316 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) {
27317         LDKChannelManager this_arg_conv;
27318         this_arg_conv.inner = untag_ptr(this_arg);
27319         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27321         this_arg_conv.is_owned = false;
27322         unsigned char channel_id_arr[32];
27323         CHECK(channel_id->arr_len == 32);
27324         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
27325         unsigned char (*channel_id_ref)[32] = &channel_id_arr;
27326         LDKPublicKey counterparty_node_id_ref;
27327         CHECK(counterparty_node_id->arr_len == 33);
27328         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
27329         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
27330         *ret_conv = ChannelManager_force_close_without_broadcasting_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
27331         return tag_ptr(ret_conv, true);
27332 }
27333
27334 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) {
27335         LDKChannelManager this_arg_conv;
27336         this_arg_conv.inner = untag_ptr(this_arg);
27337         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27339         this_arg_conv.is_owned = false;
27340         ChannelManager_force_close_all_channels_broadcasting_latest_txn(&this_arg_conv);
27341 }
27342
27343 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) {
27344         LDKChannelManager this_arg_conv;
27345         this_arg_conv.inner = untag_ptr(this_arg);
27346         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27348         this_arg_conv.is_owned = false;
27349         ChannelManager_force_close_all_channels_without_broadcasting_txn(&this_arg_conv);
27350 }
27351
27352 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) {
27353         LDKChannelManager this_arg_conv;
27354         this_arg_conv.inner = untag_ptr(this_arg);
27355         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27357         this_arg_conv.is_owned = false;
27358         LDKRoute route_conv;
27359         route_conv.inner = untag_ptr(route);
27360         route_conv.is_owned = ptr_is_owned(route);
27361         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
27362         route_conv.is_owned = false;
27363         LDKThirtyTwoBytes payment_hash_ref;
27364         CHECK(payment_hash->arr_len == 32);
27365         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
27366         LDKThirtyTwoBytes payment_secret_ref;
27367         CHECK(payment_secret->arr_len == 32);
27368         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
27369         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
27370         *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
27371         return tag_ptr(ret_conv, true);
27372 }
27373
27374 uint64_t  __attribute__((export_name("TS_ChannelManager_retry_payment"))) TS_ChannelManager_retry_payment(uint64_t this_arg, uint64_t route, int8_tArray payment_id) {
27375         LDKChannelManager this_arg_conv;
27376         this_arg_conv.inner = untag_ptr(this_arg);
27377         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27379         this_arg_conv.is_owned = false;
27380         LDKRoute route_conv;
27381         route_conv.inner = untag_ptr(route);
27382         route_conv.is_owned = ptr_is_owned(route);
27383         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
27384         route_conv.is_owned = false;
27385         LDKThirtyTwoBytes payment_id_ref;
27386         CHECK(payment_id->arr_len == 32);
27387         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
27388         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
27389         *ret_conv = ChannelManager_retry_payment(&this_arg_conv, &route_conv, payment_id_ref);
27390         return tag_ptr(ret_conv, true);
27391 }
27392
27393 void  __attribute__((export_name("TS_ChannelManager_abandon_payment"))) TS_ChannelManager_abandon_payment(uint64_t this_arg, int8_tArray payment_id) {
27394         LDKChannelManager this_arg_conv;
27395         this_arg_conv.inner = untag_ptr(this_arg);
27396         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27398         this_arg_conv.is_owned = false;
27399         LDKThirtyTwoBytes payment_id_ref;
27400         CHECK(payment_id->arr_len == 32);
27401         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
27402         ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
27403 }
27404
27405 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) {
27406         LDKChannelManager this_arg_conv;
27407         this_arg_conv.inner = untag_ptr(this_arg);
27408         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27410         this_arg_conv.is_owned = false;
27411         LDKRoute route_conv;
27412         route_conv.inner = untag_ptr(route);
27413         route_conv.is_owned = ptr_is_owned(route);
27414         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
27415         route_conv.is_owned = false;
27416         LDKThirtyTwoBytes payment_preimage_ref;
27417         CHECK(payment_preimage->arr_len == 32);
27418         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
27419         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
27420         *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref);
27421         return tag_ptr(ret_conv, true);
27422 }
27423
27424 uint64_t  __attribute__((export_name("TS_ChannelManager_send_probe"))) TS_ChannelManager_send_probe(uint64_t this_arg, uint64_tArray hops) {
27425         LDKChannelManager this_arg_conv;
27426         this_arg_conv.inner = untag_ptr(this_arg);
27427         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27429         this_arg_conv.is_owned = false;
27430         LDKCVec_RouteHopZ hops_constr;
27431         hops_constr.datalen = hops->arr_len;
27432         if (hops_constr.datalen > 0)
27433                 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
27434         else
27435                 hops_constr.data = NULL;
27436         uint64_t* hops_vals = hops->elems;
27437         for (size_t k = 0; k < hops_constr.datalen; k++) {
27438                 uint64_t hops_conv_10 = hops_vals[k];
27439                 LDKRouteHop hops_conv_10_conv;
27440                 hops_conv_10_conv.inner = untag_ptr(hops_conv_10);
27441                 hops_conv_10_conv.is_owned = ptr_is_owned(hops_conv_10);
27442                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv_10_conv);
27443                 hops_conv_10_conv = RouteHop_clone(&hops_conv_10_conv);
27444                 hops_constr.data[k] = hops_conv_10_conv;
27445         }
27446         FREE(hops);
27447         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
27448         *ret_conv = ChannelManager_send_probe(&this_arg_conv, hops_constr);
27449         return tag_ptr(ret_conv, true);
27450 }
27451
27452 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) {
27453         LDKChannelManager this_arg_conv;
27454         this_arg_conv.inner = untag_ptr(this_arg);
27455         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27457         this_arg_conv.is_owned = false;
27458         unsigned char temporary_channel_id_arr[32];
27459         CHECK(temporary_channel_id->arr_len == 32);
27460         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
27461         unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
27462         LDKPublicKey counterparty_node_id_ref;
27463         CHECK(counterparty_node_id->arr_len == 33);
27464         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
27465         LDKTransaction funding_transaction_ref;
27466         funding_transaction_ref.datalen = funding_transaction->arr_len;
27467         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
27468         memcpy(funding_transaction_ref.data, funding_transaction->elems, funding_transaction_ref.datalen); FREE(funding_transaction);
27469         funding_transaction_ref.data_is_owned = true;
27470         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
27471         *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, funding_transaction_ref);
27472         return tag_ptr(ret_conv, true);
27473 }
27474
27475 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) {
27476         LDKChannelManager this_arg_conv;
27477         this_arg_conv.inner = untag_ptr(this_arg);
27478         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27480         this_arg_conv.is_owned = false;
27481         LDKPublicKey counterparty_node_id_ref;
27482         CHECK(counterparty_node_id->arr_len == 33);
27483         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
27484         LDKCVec_ThirtyTwoBytesZ channel_ids_constr;
27485         channel_ids_constr.datalen = channel_ids->arr_len;
27486         if (channel_ids_constr.datalen > 0)
27487                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
27488         else
27489                 channel_ids_constr.data = NULL;
27490         int8_tArray* channel_ids_vals = (void*) channel_ids->elems;
27491         for (size_t m = 0; m < channel_ids_constr.datalen; m++) {
27492                 int8_tArray channel_ids_conv_12 = channel_ids_vals[m];
27493                 LDKThirtyTwoBytes channel_ids_conv_12_ref;
27494                 CHECK(channel_ids_conv_12->arr_len == 32);
27495                 memcpy(channel_ids_conv_12_ref.data, channel_ids_conv_12->elems, 32); FREE(channel_ids_conv_12);
27496                 channel_ids_constr.data[m] = channel_ids_conv_12_ref;
27497         }
27498         FREE(channel_ids);
27499         LDKChannelConfig config_conv;
27500         config_conv.inner = untag_ptr(config);
27501         config_conv.is_owned = ptr_is_owned(config);
27502         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
27503         config_conv.is_owned = false;
27504         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
27505         *ret_conv = ChannelManager_update_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_conv);
27506         return tag_ptr(ret_conv, true);
27507 }
27508
27509 void  __attribute__((export_name("TS_ChannelManager_process_pending_htlc_forwards"))) TS_ChannelManager_process_pending_htlc_forwards(uint64_t this_arg) {
27510         LDKChannelManager this_arg_conv;
27511         this_arg_conv.inner = untag_ptr(this_arg);
27512         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27514         this_arg_conv.is_owned = false;
27515         ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
27516 }
27517
27518 void  __attribute__((export_name("TS_ChannelManager_timer_tick_occurred"))) TS_ChannelManager_timer_tick_occurred(uint64_t this_arg) {
27519         LDKChannelManager this_arg_conv;
27520         this_arg_conv.inner = untag_ptr(this_arg);
27521         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27523         this_arg_conv.is_owned = false;
27524         ChannelManager_timer_tick_occurred(&this_arg_conv);
27525 }
27526
27527 void  __attribute__((export_name("TS_ChannelManager_fail_htlc_backwards"))) TS_ChannelManager_fail_htlc_backwards(uint64_t this_arg, int8_tArray payment_hash) {
27528         LDKChannelManager this_arg_conv;
27529         this_arg_conv.inner = untag_ptr(this_arg);
27530         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27532         this_arg_conv.is_owned = false;
27533         unsigned char payment_hash_arr[32];
27534         CHECK(payment_hash->arr_len == 32);
27535         memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
27536         unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
27537         ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
27538 }
27539
27540 void  __attribute__((export_name("TS_ChannelManager_claim_funds"))) TS_ChannelManager_claim_funds(uint64_t this_arg, int8_tArray payment_preimage) {
27541         LDKChannelManager this_arg_conv;
27542         this_arg_conv.inner = untag_ptr(this_arg);
27543         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27545         this_arg_conv.is_owned = false;
27546         LDKThirtyTwoBytes payment_preimage_ref;
27547         CHECK(payment_preimage->arr_len == 32);
27548         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
27549         ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
27550 }
27551
27552 int8_tArray  __attribute__((export_name("TS_ChannelManager_get_our_node_id"))) TS_ChannelManager_get_our_node_id(uint64_t this_arg) {
27553         LDKChannelManager this_arg_conv;
27554         this_arg_conv.inner = untag_ptr(this_arg);
27555         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27557         this_arg_conv.is_owned = false;
27558         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
27559         memcpy(ret_arr->elems, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
27560         return ret_arr;
27561 }
27562
27563 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) {
27564         LDKChannelManager this_arg_conv;
27565         this_arg_conv.inner = untag_ptr(this_arg);
27566         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27568         this_arg_conv.is_owned = false;
27569         unsigned char temporary_channel_id_arr[32];
27570         CHECK(temporary_channel_id->arr_len == 32);
27571         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
27572         unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
27573         LDKPublicKey counterparty_node_id_ref;
27574         CHECK(counterparty_node_id->arr_len == 33);
27575         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
27576         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
27577         *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id);
27578         return tag_ptr(ret_conv, true);
27579 }
27580
27581 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) {
27582         LDKChannelManager this_arg_conv;
27583         this_arg_conv.inner = untag_ptr(this_arg);
27584         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27586         this_arg_conv.is_owned = false;
27587         unsigned char temporary_channel_id_arr[32];
27588         CHECK(temporary_channel_id->arr_len == 32);
27589         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
27590         unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
27591         LDKPublicKey counterparty_node_id_ref;
27592         CHECK(counterparty_node_id->arr_len == 33);
27593         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
27594         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
27595         *ret_conv = ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id);
27596         return tag_ptr(ret_conv, true);
27597 }
27598
27599 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) {
27600         LDKChannelManager this_arg_conv;
27601         this_arg_conv.inner = untag_ptr(this_arg);
27602         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27604         this_arg_conv.is_owned = false;
27605         void* min_value_msat_ptr = untag_ptr(min_value_msat);
27606         CHECK_ACCESS(min_value_msat_ptr);
27607         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
27608         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
27609         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
27610         *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
27611         return tag_ptr(ret_conv, true);
27612 }
27613
27614 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) {
27615         LDKChannelManager this_arg_conv;
27616         this_arg_conv.inner = untag_ptr(this_arg);
27617         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27618         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27619         this_arg_conv.is_owned = false;
27620         void* min_value_msat_ptr = untag_ptr(min_value_msat);
27621         CHECK_ACCESS(min_value_msat_ptr);
27622         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
27623         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
27624         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
27625         *ret_conv = ChannelManager_create_inbound_payment_legacy(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
27626         return tag_ptr(ret_conv, true);
27627 }
27628
27629 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) {
27630         LDKChannelManager this_arg_conv;
27631         this_arg_conv.inner = untag_ptr(this_arg);
27632         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27634         this_arg_conv.is_owned = false;
27635         LDKThirtyTwoBytes payment_hash_ref;
27636         CHECK(payment_hash->arr_len == 32);
27637         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
27638         void* min_value_msat_ptr = untag_ptr(min_value_msat);
27639         CHECK_ACCESS(min_value_msat_ptr);
27640         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
27641         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
27642         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
27643         *ret_conv = ChannelManager_create_inbound_payment_for_hash(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
27644         return tag_ptr(ret_conv, true);
27645 }
27646
27647 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) {
27648         LDKChannelManager this_arg_conv;
27649         this_arg_conv.inner = untag_ptr(this_arg);
27650         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27652         this_arg_conv.is_owned = false;
27653         LDKThirtyTwoBytes payment_hash_ref;
27654         CHECK(payment_hash->arr_len == 32);
27655         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
27656         void* min_value_msat_ptr = untag_ptr(min_value_msat);
27657         CHECK_ACCESS(min_value_msat_ptr);
27658         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
27659         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
27660         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
27661         *ret_conv = ChannelManager_create_inbound_payment_for_hash_legacy(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
27662         return tag_ptr(ret_conv, true);
27663 }
27664
27665 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) {
27666         LDKChannelManager this_arg_conv;
27667         this_arg_conv.inner = untag_ptr(this_arg);
27668         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27670         this_arg_conv.is_owned = false;
27671         LDKThirtyTwoBytes payment_hash_ref;
27672         CHECK(payment_hash->arr_len == 32);
27673         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
27674         LDKThirtyTwoBytes payment_secret_ref;
27675         CHECK(payment_secret->arr_len == 32);
27676         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
27677         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
27678         *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
27679         return tag_ptr(ret_conv, true);
27680 }
27681
27682 int64_t  __attribute__((export_name("TS_ChannelManager_get_phantom_scid"))) TS_ChannelManager_get_phantom_scid(uint64_t this_arg) {
27683         LDKChannelManager this_arg_conv;
27684         this_arg_conv.inner = untag_ptr(this_arg);
27685         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27687         this_arg_conv.is_owned = false;
27688         int64_t ret_conv = ChannelManager_get_phantom_scid(&this_arg_conv);
27689         return ret_conv;
27690 }
27691
27692 uint64_t  __attribute__((export_name("TS_ChannelManager_get_phantom_route_hints"))) TS_ChannelManager_get_phantom_route_hints(uint64_t this_arg) {
27693         LDKChannelManager this_arg_conv;
27694         this_arg_conv.inner = untag_ptr(this_arg);
27695         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27697         this_arg_conv.is_owned = false;
27698         LDKPhantomRouteHints ret_var = ChannelManager_get_phantom_route_hints(&this_arg_conv);
27699         uint64_t ret_ref = 0;
27700         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27701         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27702         return ret_ref;
27703 }
27704
27705 uint64_t  __attribute__((export_name("TS_ChannelManager_as_MessageSendEventsProvider"))) TS_ChannelManager_as_MessageSendEventsProvider(uint64_t this_arg) {
27706         LDKChannelManager this_arg_conv;
27707         this_arg_conv.inner = untag_ptr(this_arg);
27708         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27710         this_arg_conv.is_owned = false;
27711         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
27712         *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
27713         return tag_ptr(ret_ret, true);
27714 }
27715
27716 uint64_t  __attribute__((export_name("TS_ChannelManager_as_EventsProvider"))) TS_ChannelManager_as_EventsProvider(uint64_t this_arg) {
27717         LDKChannelManager this_arg_conv;
27718         this_arg_conv.inner = untag_ptr(this_arg);
27719         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27721         this_arg_conv.is_owned = false;
27722         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
27723         *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
27724         return tag_ptr(ret_ret, true);
27725 }
27726
27727 uint64_t  __attribute__((export_name("TS_ChannelManager_as_Listen"))) TS_ChannelManager_as_Listen(uint64_t this_arg) {
27728         LDKChannelManager this_arg_conv;
27729         this_arg_conv.inner = untag_ptr(this_arg);
27730         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27732         this_arg_conv.is_owned = false;
27733         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
27734         *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
27735         return tag_ptr(ret_ret, true);
27736 }
27737
27738 uint64_t  __attribute__((export_name("TS_ChannelManager_as_Confirm"))) TS_ChannelManager_as_Confirm(uint64_t this_arg) {
27739         LDKChannelManager this_arg_conv;
27740         this_arg_conv.inner = untag_ptr(this_arg);
27741         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27743         this_arg_conv.is_owned = false;
27744         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
27745         *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
27746         return tag_ptr(ret_ret, true);
27747 }
27748
27749 void  __attribute__((export_name("TS_ChannelManager_await_persistable_update"))) TS_ChannelManager_await_persistable_update(uint64_t this_arg) {
27750         LDKChannelManager this_arg_conv;
27751         this_arg_conv.inner = untag_ptr(this_arg);
27752         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27754         this_arg_conv.is_owned = false;
27755         ChannelManager_await_persistable_update(&this_arg_conv);
27756 }
27757
27758 uint64_t  __attribute__((export_name("TS_ChannelManager_get_persistable_update_future"))) TS_ChannelManager_get_persistable_update_future(uint64_t this_arg) {
27759         LDKChannelManager this_arg_conv;
27760         this_arg_conv.inner = untag_ptr(this_arg);
27761         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27763         this_arg_conv.is_owned = false;
27764         LDKFuture ret_var = ChannelManager_get_persistable_update_future(&this_arg_conv);
27765         uint64_t ret_ref = 0;
27766         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27767         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27768         return ret_ref;
27769 }
27770
27771 uint64_t  __attribute__((export_name("TS_ChannelManager_current_best_block"))) TS_ChannelManager_current_best_block(uint64_t this_arg) {
27772         LDKChannelManager this_arg_conv;
27773         this_arg_conv.inner = untag_ptr(this_arg);
27774         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27776         this_arg_conv.is_owned = false;
27777         LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
27778         uint64_t ret_ref = 0;
27779         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27780         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27781         return ret_ref;
27782 }
27783
27784 uint64_t  __attribute__((export_name("TS_ChannelManager_as_ChannelMessageHandler"))) TS_ChannelManager_as_ChannelMessageHandler(uint64_t this_arg) {
27785         LDKChannelManager this_arg_conv;
27786         this_arg_conv.inner = untag_ptr(this_arg);
27787         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27789         this_arg_conv.is_owned = false;
27790         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
27791         *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
27792         return tag_ptr(ret_ret, true);
27793 }
27794
27795 int8_tArray  __attribute__((export_name("TS_CounterpartyForwardingInfo_write"))) TS_CounterpartyForwardingInfo_write(uint64_t obj) {
27796         LDKCounterpartyForwardingInfo obj_conv;
27797         obj_conv.inner = untag_ptr(obj);
27798         obj_conv.is_owned = ptr_is_owned(obj);
27799         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27800         obj_conv.is_owned = false;
27801         LDKCVec_u8Z ret_var = CounterpartyForwardingInfo_write(&obj_conv);
27802         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
27803         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27804         CVec_u8Z_free(ret_var);
27805         return ret_arr;
27806 }
27807
27808 uint64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_read"))) TS_CounterpartyForwardingInfo_read(int8_tArray ser) {
27809         LDKu8slice ser_ref;
27810         ser_ref.datalen = ser->arr_len;
27811         ser_ref.data = ser->elems;
27812         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
27813         *ret_conv = CounterpartyForwardingInfo_read(ser_ref);
27814         FREE(ser);
27815         return tag_ptr(ret_conv, true);
27816 }
27817
27818 int8_tArray  __attribute__((export_name("TS_ChannelCounterparty_write"))) TS_ChannelCounterparty_write(uint64_t obj) {
27819         LDKChannelCounterparty obj_conv;
27820         obj_conv.inner = untag_ptr(obj);
27821         obj_conv.is_owned = ptr_is_owned(obj);
27822         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27823         obj_conv.is_owned = false;
27824         LDKCVec_u8Z ret_var = ChannelCounterparty_write(&obj_conv);
27825         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
27826         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27827         CVec_u8Z_free(ret_var);
27828         return ret_arr;
27829 }
27830
27831 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_read"))) TS_ChannelCounterparty_read(int8_tArray ser) {
27832         LDKu8slice ser_ref;
27833         ser_ref.datalen = ser->arr_len;
27834         ser_ref.data = ser->elems;
27835         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
27836         *ret_conv = ChannelCounterparty_read(ser_ref);
27837         FREE(ser);
27838         return tag_ptr(ret_conv, true);
27839 }
27840
27841 int8_tArray  __attribute__((export_name("TS_ChannelDetails_write"))) TS_ChannelDetails_write(uint64_t obj) {
27842         LDKChannelDetails obj_conv;
27843         obj_conv.inner = untag_ptr(obj);
27844         obj_conv.is_owned = ptr_is_owned(obj);
27845         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27846         obj_conv.is_owned = false;
27847         LDKCVec_u8Z ret_var = ChannelDetails_write(&obj_conv);
27848         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
27849         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27850         CVec_u8Z_free(ret_var);
27851         return ret_arr;
27852 }
27853
27854 uint64_t  __attribute__((export_name("TS_ChannelDetails_read"))) TS_ChannelDetails_read(int8_tArray ser) {
27855         LDKu8slice ser_ref;
27856         ser_ref.datalen = ser->arr_len;
27857         ser_ref.data = ser->elems;
27858         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
27859         *ret_conv = ChannelDetails_read(ser_ref);
27860         FREE(ser);
27861         return tag_ptr(ret_conv, true);
27862 }
27863
27864 int8_tArray  __attribute__((export_name("TS_PhantomRouteHints_write"))) TS_PhantomRouteHints_write(uint64_t obj) {
27865         LDKPhantomRouteHints obj_conv;
27866         obj_conv.inner = untag_ptr(obj);
27867         obj_conv.is_owned = ptr_is_owned(obj);
27868         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27869         obj_conv.is_owned = false;
27870         LDKCVec_u8Z ret_var = PhantomRouteHints_write(&obj_conv);
27871         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
27872         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27873         CVec_u8Z_free(ret_var);
27874         return ret_arr;
27875 }
27876
27877 uint64_t  __attribute__((export_name("TS_PhantomRouteHints_read"))) TS_PhantomRouteHints_read(int8_tArray ser) {
27878         LDKu8slice ser_ref;
27879         ser_ref.datalen = ser->arr_len;
27880         ser_ref.data = ser->elems;
27881         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
27882         *ret_conv = PhantomRouteHints_read(ser_ref);
27883         FREE(ser);
27884         return tag_ptr(ret_conv, true);
27885 }
27886
27887 int8_tArray  __attribute__((export_name("TS_ChannelManager_write"))) TS_ChannelManager_write(uint64_t obj) {
27888         LDKChannelManager obj_conv;
27889         obj_conv.inner = untag_ptr(obj);
27890         obj_conv.is_owned = ptr_is_owned(obj);
27891         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27892         obj_conv.is_owned = false;
27893         LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
27894         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
27895         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27896         CVec_u8Z_free(ret_var);
27897         return ret_arr;
27898 }
27899
27900 void  __attribute__((export_name("TS_ChannelManagerReadArgs_free"))) TS_ChannelManagerReadArgs_free(uint64_t this_obj) {
27901         LDKChannelManagerReadArgs this_obj_conv;
27902         this_obj_conv.inner = untag_ptr(this_obj);
27903         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27905         ChannelManagerReadArgs_free(this_obj_conv);
27906 }
27907
27908 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_keys_manager"))) TS_ChannelManagerReadArgs_get_keys_manager(uint64_t this_ptr) {
27909         LDKChannelManagerReadArgs this_ptr_conv;
27910         this_ptr_conv.inner = untag_ptr(this_ptr);
27911         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27913         this_ptr_conv.is_owned = false;
27914         // WARNING: This object doesn't live past this scope, needs clone!
27915         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv), false);
27916         return ret_ret;
27917 }
27918
27919 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_keys_manager"))) TS_ChannelManagerReadArgs_set_keys_manager(uint64_t this_ptr, uint64_t val) {
27920         LDKChannelManagerReadArgs this_ptr_conv;
27921         this_ptr_conv.inner = untag_ptr(this_ptr);
27922         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27924         this_ptr_conv.is_owned = false;
27925         void* val_ptr = untag_ptr(val);
27926         CHECK_ACCESS(val_ptr);
27927         LDKKeysInterface val_conv = *(LDKKeysInterface*)(val_ptr);
27928         if (val_conv.free == LDKKeysInterface_JCalls_free) {
27929                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27930                 LDKKeysInterface_JCalls_cloned(&val_conv);
27931         }
27932         ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
27933 }
27934
27935 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_fee_estimator"))) TS_ChannelManagerReadArgs_get_fee_estimator(uint64_t this_ptr) {
27936         LDKChannelManagerReadArgs this_ptr_conv;
27937         this_ptr_conv.inner = untag_ptr(this_ptr);
27938         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27940         this_ptr_conv.is_owned = false;
27941         // WARNING: This object doesn't live past this scope, needs clone!
27942         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv), false);
27943         return ret_ret;
27944 }
27945
27946 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_fee_estimator"))) TS_ChannelManagerReadArgs_set_fee_estimator(uint64_t this_ptr, uint64_t val) {
27947         LDKChannelManagerReadArgs this_ptr_conv;
27948         this_ptr_conv.inner = untag_ptr(this_ptr);
27949         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27951         this_ptr_conv.is_owned = false;
27952         void* val_ptr = untag_ptr(val);
27953         CHECK_ACCESS(val_ptr);
27954         LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
27955         if (val_conv.free == LDKFeeEstimator_JCalls_free) {
27956                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27957                 LDKFeeEstimator_JCalls_cloned(&val_conv);
27958         }
27959         ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
27960 }
27961
27962 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_chain_monitor"))) TS_ChannelManagerReadArgs_get_chain_monitor(uint64_t this_ptr) {
27963         LDKChannelManagerReadArgs this_ptr_conv;
27964         this_ptr_conv.inner = untag_ptr(this_ptr);
27965         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27967         this_ptr_conv.is_owned = false;
27968         // WARNING: This object doesn't live past this scope, needs clone!
27969         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv), false);
27970         return ret_ret;
27971 }
27972
27973 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_chain_monitor"))) TS_ChannelManagerReadArgs_set_chain_monitor(uint64_t this_ptr, uint64_t val) {
27974         LDKChannelManagerReadArgs this_ptr_conv;
27975         this_ptr_conv.inner = untag_ptr(this_ptr);
27976         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27978         this_ptr_conv.is_owned = false;
27979         void* val_ptr = untag_ptr(val);
27980         CHECK_ACCESS(val_ptr);
27981         LDKWatch val_conv = *(LDKWatch*)(val_ptr);
27982         if (val_conv.free == LDKWatch_JCalls_free) {
27983                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27984                 LDKWatch_JCalls_cloned(&val_conv);
27985         }
27986         ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
27987 }
27988
27989 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_tx_broadcaster"))) TS_ChannelManagerReadArgs_get_tx_broadcaster(uint64_t this_ptr) {
27990         LDKChannelManagerReadArgs this_ptr_conv;
27991         this_ptr_conv.inner = untag_ptr(this_ptr);
27992         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27994         this_ptr_conv.is_owned = false;
27995         // WARNING: This object doesn't live past this scope, needs clone!
27996         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv), false);
27997         return ret_ret;
27998 }
27999
28000 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_tx_broadcaster"))) TS_ChannelManagerReadArgs_set_tx_broadcaster(uint64_t this_ptr, uint64_t val) {
28001         LDKChannelManagerReadArgs this_ptr_conv;
28002         this_ptr_conv.inner = untag_ptr(this_ptr);
28003         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28005         this_ptr_conv.is_owned = false;
28006         void* val_ptr = untag_ptr(val);
28007         CHECK_ACCESS(val_ptr);
28008         LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
28009         if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
28010                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28011                 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
28012         }
28013         ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
28014 }
28015
28016 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_logger"))) TS_ChannelManagerReadArgs_get_logger(uint64_t this_ptr) {
28017         LDKChannelManagerReadArgs this_ptr_conv;
28018         this_ptr_conv.inner = untag_ptr(this_ptr);
28019         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28021         this_ptr_conv.is_owned = false;
28022         // WARNING: This object doesn't live past this scope, needs clone!
28023         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_logger(&this_ptr_conv), false);
28024         return ret_ret;
28025 }
28026
28027 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_logger"))) TS_ChannelManagerReadArgs_set_logger(uint64_t this_ptr, uint64_t val) {
28028         LDKChannelManagerReadArgs this_ptr_conv;
28029         this_ptr_conv.inner = untag_ptr(this_ptr);
28030         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28032         this_ptr_conv.is_owned = false;
28033         void* val_ptr = untag_ptr(val);
28034         CHECK_ACCESS(val_ptr);
28035         LDKLogger val_conv = *(LDKLogger*)(val_ptr);
28036         if (val_conv.free == LDKLogger_JCalls_free) {
28037                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28038                 LDKLogger_JCalls_cloned(&val_conv);
28039         }
28040         ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
28041 }
28042
28043 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_default_config"))) TS_ChannelManagerReadArgs_get_default_config(uint64_t this_ptr) {
28044         LDKChannelManagerReadArgs this_ptr_conv;
28045         this_ptr_conv.inner = untag_ptr(this_ptr);
28046         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28048         this_ptr_conv.is_owned = false;
28049         LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
28050         uint64_t ret_ref = 0;
28051         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28052         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28053         return ret_ref;
28054 }
28055
28056 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_default_config"))) TS_ChannelManagerReadArgs_set_default_config(uint64_t this_ptr, uint64_t val) {
28057         LDKChannelManagerReadArgs this_ptr_conv;
28058         this_ptr_conv.inner = untag_ptr(this_ptr);
28059         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28061         this_ptr_conv.is_owned = false;
28062         LDKUserConfig val_conv;
28063         val_conv.inner = untag_ptr(val);
28064         val_conv.is_owned = ptr_is_owned(val);
28065         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28066         val_conv = UserConfig_clone(&val_conv);
28067         ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
28068 }
28069
28070 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) {
28071         void* keys_manager_ptr = untag_ptr(keys_manager);
28072         CHECK_ACCESS(keys_manager_ptr);
28073         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
28074         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
28075                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28076                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
28077         }
28078         void* fee_estimator_ptr = untag_ptr(fee_estimator);
28079         CHECK_ACCESS(fee_estimator_ptr);
28080         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
28081         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
28082                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28083                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
28084         }
28085         void* chain_monitor_ptr = untag_ptr(chain_monitor);
28086         CHECK_ACCESS(chain_monitor_ptr);
28087         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
28088         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
28089                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28090                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
28091         }
28092         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
28093         CHECK_ACCESS(tx_broadcaster_ptr);
28094         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
28095         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
28096                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28097                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
28098         }
28099         void* logger_ptr = untag_ptr(logger);
28100         CHECK_ACCESS(logger_ptr);
28101         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
28102         if (logger_conv.free == LDKLogger_JCalls_free) {
28103                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28104                 LDKLogger_JCalls_cloned(&logger_conv);
28105         }
28106         LDKUserConfig default_config_conv;
28107         default_config_conv.inner = untag_ptr(default_config);
28108         default_config_conv.is_owned = ptr_is_owned(default_config);
28109         CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
28110         default_config_conv = UserConfig_clone(&default_config_conv);
28111         LDKCVec_ChannelMonitorZ channel_monitors_constr;
28112         channel_monitors_constr.datalen = channel_monitors->arr_len;
28113         if (channel_monitors_constr.datalen > 0)
28114                 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
28115         else
28116                 channel_monitors_constr.data = NULL;
28117         uint64_t* channel_monitors_vals = channel_monitors->elems;
28118         for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
28119                 uint64_t channel_monitors_conv_16 = channel_monitors_vals[q];
28120                 LDKChannelMonitor channel_monitors_conv_16_conv;
28121                 channel_monitors_conv_16_conv.inner = untag_ptr(channel_monitors_conv_16);
28122                 channel_monitors_conv_16_conv.is_owned = ptr_is_owned(channel_monitors_conv_16);
28123                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
28124                 channel_monitors_conv_16_conv.is_owned = false;
28125                 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
28126         }
28127         FREE(channel_monitors);
28128         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);
28129         uint64_t ret_ref = 0;
28130         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28131         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28132         return ret_ref;
28133 }
28134
28135 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_read"))) TS_C2Tuple_BlockHashChannelManagerZ_read(int8_tArray ser, uint64_t arg) {
28136         LDKu8slice ser_ref;
28137         ser_ref.datalen = ser->arr_len;
28138         ser_ref.data = ser->elems;
28139         LDKChannelManagerReadArgs arg_conv;
28140         arg_conv.inner = untag_ptr(arg);
28141         arg_conv.is_owned = ptr_is_owned(arg);
28142         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28143         // WARNING: we need a move here but no clone is available for LDKChannelManagerReadArgs
28144         
28145         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
28146         *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
28147         FREE(ser);
28148         return tag_ptr(ret_conv, true);
28149 }
28150
28151 void  __attribute__((export_name("TS_ExpandedKey_free"))) TS_ExpandedKey_free(uint64_t this_obj) {
28152         LDKExpandedKey this_obj_conv;
28153         this_obj_conv.inner = untag_ptr(this_obj);
28154         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28156         ExpandedKey_free(this_obj_conv);
28157 }
28158
28159 uint64_t  __attribute__((export_name("TS_ExpandedKey_new"))) TS_ExpandedKey_new(int8_tArray key_material) {
28160         unsigned char key_material_arr[32];
28161         CHECK(key_material->arr_len == 32);
28162         memcpy(key_material_arr, key_material->elems, 32); FREE(key_material);
28163         unsigned char (*key_material_ref)[32] = &key_material_arr;
28164         LDKExpandedKey ret_var = ExpandedKey_new(key_material_ref);
28165         uint64_t ret_ref = 0;
28166         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28167         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28168         return ret_ref;
28169 }
28170
28171 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) {
28172         LDKExpandedKey keys_conv;
28173         keys_conv.inner = untag_ptr(keys);
28174         keys_conv.is_owned = ptr_is_owned(keys);
28175         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
28176         keys_conv.is_owned = false;
28177         void* min_value_msat_ptr = untag_ptr(min_value_msat);
28178         CHECK_ACCESS(min_value_msat_ptr);
28179         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
28180         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
28181         void* keys_manager_ptr = untag_ptr(keys_manager);
28182         if (ptr_is_owned(keys_manager)) { CHECK_ACCESS(keys_manager_ptr); }
28183         LDKKeysInterface* keys_manager_conv = (LDKKeysInterface*)keys_manager_ptr;
28184         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
28185         *ret_conv = create(&keys_conv, min_value_msat_conv, invoice_expiry_delta_secs, keys_manager_conv, current_time);
28186         return tag_ptr(ret_conv, true);
28187 }
28188
28189 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) {
28190         LDKExpandedKey keys_conv;
28191         keys_conv.inner = untag_ptr(keys);
28192         keys_conv.is_owned = ptr_is_owned(keys);
28193         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
28194         keys_conv.is_owned = false;
28195         void* min_value_msat_ptr = untag_ptr(min_value_msat);
28196         CHECK_ACCESS(min_value_msat_ptr);
28197         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
28198         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
28199         LDKThirtyTwoBytes payment_hash_ref;
28200         CHECK(payment_hash->arr_len == 32);
28201         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
28202         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
28203         *ret_conv = create_from_hash(&keys_conv, min_value_msat_conv, payment_hash_ref, invoice_expiry_delta_secs, current_time);
28204         return tag_ptr(ret_conv, true);
28205 }
28206
28207 void  __attribute__((export_name("TS_DecodeError_free"))) TS_DecodeError_free(uint64_t this_obj) {
28208         LDKDecodeError this_obj_conv;
28209         this_obj_conv.inner = untag_ptr(this_obj);
28210         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28212         DecodeError_free(this_obj_conv);
28213 }
28214
28215 static inline uint64_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
28216         LDKDecodeError ret_var = DecodeError_clone(arg);
28217         uint64_t ret_ref = 0;
28218         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28219         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28220         return ret_ref;
28221 }
28222 int64_t  __attribute__((export_name("TS_DecodeError_clone_ptr"))) TS_DecodeError_clone_ptr(uint64_t arg) {
28223         LDKDecodeError arg_conv;
28224         arg_conv.inner = untag_ptr(arg);
28225         arg_conv.is_owned = ptr_is_owned(arg);
28226         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28227         arg_conv.is_owned = false;
28228         int64_t ret_conv = DecodeError_clone_ptr(&arg_conv);
28229         return ret_conv;
28230 }
28231
28232 uint64_t  __attribute__((export_name("TS_DecodeError_clone"))) TS_DecodeError_clone(uint64_t orig) {
28233         LDKDecodeError orig_conv;
28234         orig_conv.inner = untag_ptr(orig);
28235         orig_conv.is_owned = ptr_is_owned(orig);
28236         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28237         orig_conv.is_owned = false;
28238         LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
28239         uint64_t ret_ref = 0;
28240         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28241         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28242         return ret_ref;
28243 }
28244
28245 void  __attribute__((export_name("TS_Init_free"))) TS_Init_free(uint64_t this_obj) {
28246         LDKInit this_obj_conv;
28247         this_obj_conv.inner = untag_ptr(this_obj);
28248         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28250         Init_free(this_obj_conv);
28251 }
28252
28253 uint64_t  __attribute__((export_name("TS_Init_get_features"))) TS_Init_get_features(uint64_t this_ptr) {
28254         LDKInit this_ptr_conv;
28255         this_ptr_conv.inner = untag_ptr(this_ptr);
28256         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28258         this_ptr_conv.is_owned = false;
28259         LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
28260         uint64_t ret_ref = 0;
28261         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28262         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28263         return ret_ref;
28264 }
28265
28266 void  __attribute__((export_name("TS_Init_set_features"))) TS_Init_set_features(uint64_t this_ptr, uint64_t val) {
28267         LDKInit this_ptr_conv;
28268         this_ptr_conv.inner = untag_ptr(this_ptr);
28269         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28271         this_ptr_conv.is_owned = false;
28272         LDKInitFeatures val_conv;
28273         val_conv.inner = untag_ptr(val);
28274         val_conv.is_owned = ptr_is_owned(val);
28275         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28276         val_conv = InitFeatures_clone(&val_conv);
28277         Init_set_features(&this_ptr_conv, val_conv);
28278 }
28279
28280 uint64_t  __attribute__((export_name("TS_Init_get_remote_network_address"))) TS_Init_get_remote_network_address(uint64_t this_ptr) {
28281         LDKInit this_ptr_conv;
28282         this_ptr_conv.inner = untag_ptr(this_ptr);
28283         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28285         this_ptr_conv.is_owned = false;
28286         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
28287         *ret_copy = Init_get_remote_network_address(&this_ptr_conv);
28288         uint64_t ret_ref = tag_ptr(ret_copy, true);
28289         return ret_ref;
28290 }
28291
28292 void  __attribute__((export_name("TS_Init_set_remote_network_address"))) TS_Init_set_remote_network_address(uint64_t this_ptr, uint64_t val) {
28293         LDKInit this_ptr_conv;
28294         this_ptr_conv.inner = untag_ptr(this_ptr);
28295         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28297         this_ptr_conv.is_owned = false;
28298         void* val_ptr = untag_ptr(val);
28299         CHECK_ACCESS(val_ptr);
28300         LDKCOption_NetAddressZ val_conv = *(LDKCOption_NetAddressZ*)(val_ptr);
28301         val_conv = COption_NetAddressZ_clone((LDKCOption_NetAddressZ*)untag_ptr(val));
28302         Init_set_remote_network_address(&this_ptr_conv, val_conv);
28303 }
28304
28305 uint64_t  __attribute__((export_name("TS_Init_new"))) TS_Init_new(uint64_t features_arg, uint64_t remote_network_address_arg) {
28306         LDKInitFeatures features_arg_conv;
28307         features_arg_conv.inner = untag_ptr(features_arg);
28308         features_arg_conv.is_owned = ptr_is_owned(features_arg);
28309         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
28310         features_arg_conv = InitFeatures_clone(&features_arg_conv);
28311         void* remote_network_address_arg_ptr = untag_ptr(remote_network_address_arg);
28312         CHECK_ACCESS(remote_network_address_arg_ptr);
28313         LDKCOption_NetAddressZ remote_network_address_arg_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_arg_ptr);
28314         LDKInit ret_var = Init_new(features_arg_conv, remote_network_address_arg_conv);
28315         uint64_t ret_ref = 0;
28316         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28317         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28318         return ret_ref;
28319 }
28320
28321 static inline uint64_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
28322         LDKInit ret_var = Init_clone(arg);
28323         uint64_t ret_ref = 0;
28324         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28325         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28326         return ret_ref;
28327 }
28328 int64_t  __attribute__((export_name("TS_Init_clone_ptr"))) TS_Init_clone_ptr(uint64_t arg) {
28329         LDKInit arg_conv;
28330         arg_conv.inner = untag_ptr(arg);
28331         arg_conv.is_owned = ptr_is_owned(arg);
28332         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28333         arg_conv.is_owned = false;
28334         int64_t ret_conv = Init_clone_ptr(&arg_conv);
28335         return ret_conv;
28336 }
28337
28338 uint64_t  __attribute__((export_name("TS_Init_clone"))) TS_Init_clone(uint64_t orig) {
28339         LDKInit orig_conv;
28340         orig_conv.inner = untag_ptr(orig);
28341         orig_conv.is_owned = ptr_is_owned(orig);
28342         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28343         orig_conv.is_owned = false;
28344         LDKInit ret_var = Init_clone(&orig_conv);
28345         uint64_t ret_ref = 0;
28346         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28347         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28348         return ret_ref;
28349 }
28350
28351 void  __attribute__((export_name("TS_ErrorMessage_free"))) TS_ErrorMessage_free(uint64_t this_obj) {
28352         LDKErrorMessage this_obj_conv;
28353         this_obj_conv.inner = untag_ptr(this_obj);
28354         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28356         ErrorMessage_free(this_obj_conv);
28357 }
28358
28359 int8_tArray  __attribute__((export_name("TS_ErrorMessage_get_channel_id"))) TS_ErrorMessage_get_channel_id(uint64_t this_ptr) {
28360         LDKErrorMessage this_ptr_conv;
28361         this_ptr_conv.inner = untag_ptr(this_ptr);
28362         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28363         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28364         this_ptr_conv.is_owned = false;
28365         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28366         memcpy(ret_arr->elems, *ErrorMessage_get_channel_id(&this_ptr_conv), 32);
28367         return ret_arr;
28368 }
28369
28370 void  __attribute__((export_name("TS_ErrorMessage_set_channel_id"))) TS_ErrorMessage_set_channel_id(uint64_t this_ptr, int8_tArray val) {
28371         LDKErrorMessage this_ptr_conv;
28372         this_ptr_conv.inner = untag_ptr(this_ptr);
28373         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28375         this_ptr_conv.is_owned = false;
28376         LDKThirtyTwoBytes val_ref;
28377         CHECK(val->arr_len == 32);
28378         memcpy(val_ref.data, val->elems, 32); FREE(val);
28379         ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
28380 }
28381
28382 jstring  __attribute__((export_name("TS_ErrorMessage_get_data"))) TS_ErrorMessage_get_data(uint64_t this_ptr) {
28383         LDKErrorMessage this_ptr_conv;
28384         this_ptr_conv.inner = untag_ptr(this_ptr);
28385         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28387         this_ptr_conv.is_owned = false;
28388         LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
28389         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
28390         Str_free(ret_str);
28391         return ret_conv;
28392 }
28393
28394 void  __attribute__((export_name("TS_ErrorMessage_set_data"))) TS_ErrorMessage_set_data(uint64_t this_ptr, jstring val) {
28395         LDKErrorMessage this_ptr_conv;
28396         this_ptr_conv.inner = untag_ptr(this_ptr);
28397         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28399         this_ptr_conv.is_owned = false;
28400         LDKStr val_conv = str_ref_to_owned_c(val);
28401         ErrorMessage_set_data(&this_ptr_conv, val_conv);
28402 }
28403
28404 uint64_t  __attribute__((export_name("TS_ErrorMessage_new"))) TS_ErrorMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
28405         LDKThirtyTwoBytes channel_id_arg_ref;
28406         CHECK(channel_id_arg->arr_len == 32);
28407         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
28408         LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
28409         LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
28410         uint64_t ret_ref = 0;
28411         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28412         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28413         return ret_ref;
28414 }
28415
28416 static inline uint64_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
28417         LDKErrorMessage ret_var = ErrorMessage_clone(arg);
28418         uint64_t ret_ref = 0;
28419         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28420         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28421         return ret_ref;
28422 }
28423 int64_t  __attribute__((export_name("TS_ErrorMessage_clone_ptr"))) TS_ErrorMessage_clone_ptr(uint64_t arg) {
28424         LDKErrorMessage arg_conv;
28425         arg_conv.inner = untag_ptr(arg);
28426         arg_conv.is_owned = ptr_is_owned(arg);
28427         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28428         arg_conv.is_owned = false;
28429         int64_t ret_conv = ErrorMessage_clone_ptr(&arg_conv);
28430         return ret_conv;
28431 }
28432
28433 uint64_t  __attribute__((export_name("TS_ErrorMessage_clone"))) TS_ErrorMessage_clone(uint64_t orig) {
28434         LDKErrorMessage orig_conv;
28435         orig_conv.inner = untag_ptr(orig);
28436         orig_conv.is_owned = ptr_is_owned(orig);
28437         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28438         orig_conv.is_owned = false;
28439         LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
28440         uint64_t ret_ref = 0;
28441         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28442         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28443         return ret_ref;
28444 }
28445
28446 void  __attribute__((export_name("TS_WarningMessage_free"))) TS_WarningMessage_free(uint64_t this_obj) {
28447         LDKWarningMessage this_obj_conv;
28448         this_obj_conv.inner = untag_ptr(this_obj);
28449         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28451         WarningMessage_free(this_obj_conv);
28452 }
28453
28454 int8_tArray  __attribute__((export_name("TS_WarningMessage_get_channel_id"))) TS_WarningMessage_get_channel_id(uint64_t this_ptr) {
28455         LDKWarningMessage this_ptr_conv;
28456         this_ptr_conv.inner = untag_ptr(this_ptr);
28457         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28459         this_ptr_conv.is_owned = false;
28460         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28461         memcpy(ret_arr->elems, *WarningMessage_get_channel_id(&this_ptr_conv), 32);
28462         return ret_arr;
28463 }
28464
28465 void  __attribute__((export_name("TS_WarningMessage_set_channel_id"))) TS_WarningMessage_set_channel_id(uint64_t this_ptr, int8_tArray val) {
28466         LDKWarningMessage this_ptr_conv;
28467         this_ptr_conv.inner = untag_ptr(this_ptr);
28468         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28470         this_ptr_conv.is_owned = false;
28471         LDKThirtyTwoBytes val_ref;
28472         CHECK(val->arr_len == 32);
28473         memcpy(val_ref.data, val->elems, 32); FREE(val);
28474         WarningMessage_set_channel_id(&this_ptr_conv, val_ref);
28475 }
28476
28477 jstring  __attribute__((export_name("TS_WarningMessage_get_data"))) TS_WarningMessage_get_data(uint64_t this_ptr) {
28478         LDKWarningMessage this_ptr_conv;
28479         this_ptr_conv.inner = untag_ptr(this_ptr);
28480         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28482         this_ptr_conv.is_owned = false;
28483         LDKStr ret_str = WarningMessage_get_data(&this_ptr_conv);
28484         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
28485         Str_free(ret_str);
28486         return ret_conv;
28487 }
28488
28489 void  __attribute__((export_name("TS_WarningMessage_set_data"))) TS_WarningMessage_set_data(uint64_t this_ptr, jstring val) {
28490         LDKWarningMessage this_ptr_conv;
28491         this_ptr_conv.inner = untag_ptr(this_ptr);
28492         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28494         this_ptr_conv.is_owned = false;
28495         LDKStr val_conv = str_ref_to_owned_c(val);
28496         WarningMessage_set_data(&this_ptr_conv, val_conv);
28497 }
28498
28499 uint64_t  __attribute__((export_name("TS_WarningMessage_new"))) TS_WarningMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
28500         LDKThirtyTwoBytes channel_id_arg_ref;
28501         CHECK(channel_id_arg->arr_len == 32);
28502         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
28503         LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
28504         LDKWarningMessage ret_var = WarningMessage_new(channel_id_arg_ref, data_arg_conv);
28505         uint64_t ret_ref = 0;
28506         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28507         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28508         return ret_ref;
28509 }
28510
28511 static inline uint64_t WarningMessage_clone_ptr(LDKWarningMessage *NONNULL_PTR arg) {
28512         LDKWarningMessage ret_var = WarningMessage_clone(arg);
28513         uint64_t ret_ref = 0;
28514         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28515         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28516         return ret_ref;
28517 }
28518 int64_t  __attribute__((export_name("TS_WarningMessage_clone_ptr"))) TS_WarningMessage_clone_ptr(uint64_t arg) {
28519         LDKWarningMessage arg_conv;
28520         arg_conv.inner = untag_ptr(arg);
28521         arg_conv.is_owned = ptr_is_owned(arg);
28522         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28523         arg_conv.is_owned = false;
28524         int64_t ret_conv = WarningMessage_clone_ptr(&arg_conv);
28525         return ret_conv;
28526 }
28527
28528 uint64_t  __attribute__((export_name("TS_WarningMessage_clone"))) TS_WarningMessage_clone(uint64_t orig) {
28529         LDKWarningMessage orig_conv;
28530         orig_conv.inner = untag_ptr(orig);
28531         orig_conv.is_owned = ptr_is_owned(orig);
28532         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28533         orig_conv.is_owned = false;
28534         LDKWarningMessage ret_var = WarningMessage_clone(&orig_conv);
28535         uint64_t ret_ref = 0;
28536         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28537         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28538         return ret_ref;
28539 }
28540
28541 void  __attribute__((export_name("TS_Ping_free"))) TS_Ping_free(uint64_t this_obj) {
28542         LDKPing this_obj_conv;
28543         this_obj_conv.inner = untag_ptr(this_obj);
28544         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28546         Ping_free(this_obj_conv);
28547 }
28548
28549 int16_t  __attribute__((export_name("TS_Ping_get_ponglen"))) TS_Ping_get_ponglen(uint64_t this_ptr) {
28550         LDKPing this_ptr_conv;
28551         this_ptr_conv.inner = untag_ptr(this_ptr);
28552         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28554         this_ptr_conv.is_owned = false;
28555         int16_t ret_conv = Ping_get_ponglen(&this_ptr_conv);
28556         return ret_conv;
28557 }
28558
28559 void  __attribute__((export_name("TS_Ping_set_ponglen"))) TS_Ping_set_ponglen(uint64_t this_ptr, int16_t val) {
28560         LDKPing this_ptr_conv;
28561         this_ptr_conv.inner = untag_ptr(this_ptr);
28562         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28563         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28564         this_ptr_conv.is_owned = false;
28565         Ping_set_ponglen(&this_ptr_conv, val);
28566 }
28567
28568 int16_t  __attribute__((export_name("TS_Ping_get_byteslen"))) TS_Ping_get_byteslen(uint64_t this_ptr) {
28569         LDKPing this_ptr_conv;
28570         this_ptr_conv.inner = untag_ptr(this_ptr);
28571         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28573         this_ptr_conv.is_owned = false;
28574         int16_t ret_conv = Ping_get_byteslen(&this_ptr_conv);
28575         return ret_conv;
28576 }
28577
28578 void  __attribute__((export_name("TS_Ping_set_byteslen"))) TS_Ping_set_byteslen(uint64_t this_ptr, int16_t val) {
28579         LDKPing this_ptr_conv;
28580         this_ptr_conv.inner = untag_ptr(this_ptr);
28581         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28583         this_ptr_conv.is_owned = false;
28584         Ping_set_byteslen(&this_ptr_conv, val);
28585 }
28586
28587 uint64_t  __attribute__((export_name("TS_Ping_new"))) TS_Ping_new(int16_t ponglen_arg, int16_t byteslen_arg) {
28588         LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
28589         uint64_t ret_ref = 0;
28590         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28591         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28592         return ret_ref;
28593 }
28594
28595 static inline uint64_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
28596         LDKPing ret_var = Ping_clone(arg);
28597         uint64_t ret_ref = 0;
28598         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28599         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28600         return ret_ref;
28601 }
28602 int64_t  __attribute__((export_name("TS_Ping_clone_ptr"))) TS_Ping_clone_ptr(uint64_t arg) {
28603         LDKPing arg_conv;
28604         arg_conv.inner = untag_ptr(arg);
28605         arg_conv.is_owned = ptr_is_owned(arg);
28606         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28607         arg_conv.is_owned = false;
28608         int64_t ret_conv = Ping_clone_ptr(&arg_conv);
28609         return ret_conv;
28610 }
28611
28612 uint64_t  __attribute__((export_name("TS_Ping_clone"))) TS_Ping_clone(uint64_t orig) {
28613         LDKPing orig_conv;
28614         orig_conv.inner = untag_ptr(orig);
28615         orig_conv.is_owned = ptr_is_owned(orig);
28616         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28617         orig_conv.is_owned = false;
28618         LDKPing ret_var = Ping_clone(&orig_conv);
28619         uint64_t ret_ref = 0;
28620         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28621         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28622         return ret_ref;
28623 }
28624
28625 void  __attribute__((export_name("TS_Pong_free"))) TS_Pong_free(uint64_t this_obj) {
28626         LDKPong this_obj_conv;
28627         this_obj_conv.inner = untag_ptr(this_obj);
28628         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28630         Pong_free(this_obj_conv);
28631 }
28632
28633 int16_t  __attribute__((export_name("TS_Pong_get_byteslen"))) TS_Pong_get_byteslen(uint64_t this_ptr) {
28634         LDKPong this_ptr_conv;
28635         this_ptr_conv.inner = untag_ptr(this_ptr);
28636         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28638         this_ptr_conv.is_owned = false;
28639         int16_t ret_conv = Pong_get_byteslen(&this_ptr_conv);
28640         return ret_conv;
28641 }
28642
28643 void  __attribute__((export_name("TS_Pong_set_byteslen"))) TS_Pong_set_byteslen(uint64_t this_ptr, int16_t val) {
28644         LDKPong this_ptr_conv;
28645         this_ptr_conv.inner = untag_ptr(this_ptr);
28646         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28648         this_ptr_conv.is_owned = false;
28649         Pong_set_byteslen(&this_ptr_conv, val);
28650 }
28651
28652 uint64_t  __attribute__((export_name("TS_Pong_new"))) TS_Pong_new(int16_t byteslen_arg) {
28653         LDKPong ret_var = Pong_new(byteslen_arg);
28654         uint64_t ret_ref = 0;
28655         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28656         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28657         return ret_ref;
28658 }
28659
28660 static inline uint64_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
28661         LDKPong ret_var = Pong_clone(arg);
28662         uint64_t ret_ref = 0;
28663         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28664         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28665         return ret_ref;
28666 }
28667 int64_t  __attribute__((export_name("TS_Pong_clone_ptr"))) TS_Pong_clone_ptr(uint64_t arg) {
28668         LDKPong arg_conv;
28669         arg_conv.inner = untag_ptr(arg);
28670         arg_conv.is_owned = ptr_is_owned(arg);
28671         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28672         arg_conv.is_owned = false;
28673         int64_t ret_conv = Pong_clone_ptr(&arg_conv);
28674         return ret_conv;
28675 }
28676
28677 uint64_t  __attribute__((export_name("TS_Pong_clone"))) TS_Pong_clone(uint64_t orig) {
28678         LDKPong orig_conv;
28679         orig_conv.inner = untag_ptr(orig);
28680         orig_conv.is_owned = ptr_is_owned(orig);
28681         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28682         orig_conv.is_owned = false;
28683         LDKPong ret_var = Pong_clone(&orig_conv);
28684         uint64_t ret_ref = 0;
28685         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28686         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28687         return ret_ref;
28688 }
28689
28690 void  __attribute__((export_name("TS_OpenChannel_free"))) TS_OpenChannel_free(uint64_t this_obj) {
28691         LDKOpenChannel this_obj_conv;
28692         this_obj_conv.inner = untag_ptr(this_obj);
28693         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28695         OpenChannel_free(this_obj_conv);
28696 }
28697
28698 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_chain_hash"))) TS_OpenChannel_get_chain_hash(uint64_t this_ptr) {
28699         LDKOpenChannel this_ptr_conv;
28700         this_ptr_conv.inner = untag_ptr(this_ptr);
28701         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28703         this_ptr_conv.is_owned = false;
28704         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28705         memcpy(ret_arr->elems, *OpenChannel_get_chain_hash(&this_ptr_conv), 32);
28706         return ret_arr;
28707 }
28708
28709 void  __attribute__((export_name("TS_OpenChannel_set_chain_hash"))) TS_OpenChannel_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
28710         LDKOpenChannel this_ptr_conv;
28711         this_ptr_conv.inner = untag_ptr(this_ptr);
28712         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28714         this_ptr_conv.is_owned = false;
28715         LDKThirtyTwoBytes val_ref;
28716         CHECK(val->arr_len == 32);
28717         memcpy(val_ref.data, val->elems, 32); FREE(val);
28718         OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
28719 }
28720
28721 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_temporary_channel_id"))) TS_OpenChannel_get_temporary_channel_id(uint64_t this_ptr) {
28722         LDKOpenChannel this_ptr_conv;
28723         this_ptr_conv.inner = untag_ptr(this_ptr);
28724         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28726         this_ptr_conv.is_owned = false;
28727         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28728         memcpy(ret_arr->elems, *OpenChannel_get_temporary_channel_id(&this_ptr_conv), 32);
28729         return ret_arr;
28730 }
28731
28732 void  __attribute__((export_name("TS_OpenChannel_set_temporary_channel_id"))) TS_OpenChannel_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
28733         LDKOpenChannel this_ptr_conv;
28734         this_ptr_conv.inner = untag_ptr(this_ptr);
28735         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28737         this_ptr_conv.is_owned = false;
28738         LDKThirtyTwoBytes val_ref;
28739         CHECK(val->arr_len == 32);
28740         memcpy(val_ref.data, val->elems, 32); FREE(val);
28741         OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
28742 }
28743
28744 int64_t  __attribute__((export_name("TS_OpenChannel_get_funding_satoshis"))) TS_OpenChannel_get_funding_satoshis(uint64_t this_ptr) {
28745         LDKOpenChannel this_ptr_conv;
28746         this_ptr_conv.inner = untag_ptr(this_ptr);
28747         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28749         this_ptr_conv.is_owned = false;
28750         int64_t ret_conv = OpenChannel_get_funding_satoshis(&this_ptr_conv);
28751         return ret_conv;
28752 }
28753
28754 void  __attribute__((export_name("TS_OpenChannel_set_funding_satoshis"))) TS_OpenChannel_set_funding_satoshis(uint64_t this_ptr, int64_t val) {
28755         LDKOpenChannel this_ptr_conv;
28756         this_ptr_conv.inner = untag_ptr(this_ptr);
28757         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28759         this_ptr_conv.is_owned = false;
28760         OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
28761 }
28762
28763 int64_t  __attribute__((export_name("TS_OpenChannel_get_push_msat"))) TS_OpenChannel_get_push_msat(uint64_t this_ptr) {
28764         LDKOpenChannel this_ptr_conv;
28765         this_ptr_conv.inner = untag_ptr(this_ptr);
28766         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28768         this_ptr_conv.is_owned = false;
28769         int64_t ret_conv = OpenChannel_get_push_msat(&this_ptr_conv);
28770         return ret_conv;
28771 }
28772
28773 void  __attribute__((export_name("TS_OpenChannel_set_push_msat"))) TS_OpenChannel_set_push_msat(uint64_t this_ptr, int64_t val) {
28774         LDKOpenChannel this_ptr_conv;
28775         this_ptr_conv.inner = untag_ptr(this_ptr);
28776         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28778         this_ptr_conv.is_owned = false;
28779         OpenChannel_set_push_msat(&this_ptr_conv, val);
28780 }
28781
28782 int64_t  __attribute__((export_name("TS_OpenChannel_get_dust_limit_satoshis"))) TS_OpenChannel_get_dust_limit_satoshis(uint64_t this_ptr) {
28783         LDKOpenChannel this_ptr_conv;
28784         this_ptr_conv.inner = untag_ptr(this_ptr);
28785         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28787         this_ptr_conv.is_owned = false;
28788         int64_t ret_conv = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
28789         return ret_conv;
28790 }
28791
28792 void  __attribute__((export_name("TS_OpenChannel_set_dust_limit_satoshis"))) TS_OpenChannel_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
28793         LDKOpenChannel this_ptr_conv;
28794         this_ptr_conv.inner = untag_ptr(this_ptr);
28795         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28797         this_ptr_conv.is_owned = false;
28798         OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
28799 }
28800
28801 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) {
28802         LDKOpenChannel this_ptr_conv;
28803         this_ptr_conv.inner = untag_ptr(this_ptr);
28804         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28806         this_ptr_conv.is_owned = false;
28807         int64_t ret_conv = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
28808         return ret_conv;
28809 }
28810
28811 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) {
28812         LDKOpenChannel this_ptr_conv;
28813         this_ptr_conv.inner = untag_ptr(this_ptr);
28814         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28816         this_ptr_conv.is_owned = false;
28817         OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
28818 }
28819
28820 int64_t  __attribute__((export_name("TS_OpenChannel_get_channel_reserve_satoshis"))) TS_OpenChannel_get_channel_reserve_satoshis(uint64_t this_ptr) {
28821         LDKOpenChannel this_ptr_conv;
28822         this_ptr_conv.inner = untag_ptr(this_ptr);
28823         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28825         this_ptr_conv.is_owned = false;
28826         int64_t ret_conv = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
28827         return ret_conv;
28828 }
28829
28830 void  __attribute__((export_name("TS_OpenChannel_set_channel_reserve_satoshis"))) TS_OpenChannel_set_channel_reserve_satoshis(uint64_t this_ptr, int64_t val) {
28831         LDKOpenChannel this_ptr_conv;
28832         this_ptr_conv.inner = untag_ptr(this_ptr);
28833         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28835         this_ptr_conv.is_owned = false;
28836         OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
28837 }
28838
28839 int64_t  __attribute__((export_name("TS_OpenChannel_get_htlc_minimum_msat"))) TS_OpenChannel_get_htlc_minimum_msat(uint64_t this_ptr) {
28840         LDKOpenChannel this_ptr_conv;
28841         this_ptr_conv.inner = untag_ptr(this_ptr);
28842         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28844         this_ptr_conv.is_owned = false;
28845         int64_t ret_conv = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
28846         return ret_conv;
28847 }
28848
28849 void  __attribute__((export_name("TS_OpenChannel_set_htlc_minimum_msat"))) TS_OpenChannel_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
28850         LDKOpenChannel this_ptr_conv;
28851         this_ptr_conv.inner = untag_ptr(this_ptr);
28852         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28854         this_ptr_conv.is_owned = false;
28855         OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
28856 }
28857
28858 int32_t  __attribute__((export_name("TS_OpenChannel_get_feerate_per_kw"))) TS_OpenChannel_get_feerate_per_kw(uint64_t this_ptr) {
28859         LDKOpenChannel this_ptr_conv;
28860         this_ptr_conv.inner = untag_ptr(this_ptr);
28861         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28863         this_ptr_conv.is_owned = false;
28864         int32_t ret_conv = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
28865         return ret_conv;
28866 }
28867
28868 void  __attribute__((export_name("TS_OpenChannel_set_feerate_per_kw"))) TS_OpenChannel_set_feerate_per_kw(uint64_t this_ptr, int32_t val) {
28869         LDKOpenChannel this_ptr_conv;
28870         this_ptr_conv.inner = untag_ptr(this_ptr);
28871         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28873         this_ptr_conv.is_owned = false;
28874         OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
28875 }
28876
28877 int16_t  __attribute__((export_name("TS_OpenChannel_get_to_self_delay"))) TS_OpenChannel_get_to_self_delay(uint64_t this_ptr) {
28878         LDKOpenChannel this_ptr_conv;
28879         this_ptr_conv.inner = untag_ptr(this_ptr);
28880         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28882         this_ptr_conv.is_owned = false;
28883         int16_t ret_conv = OpenChannel_get_to_self_delay(&this_ptr_conv);
28884         return ret_conv;
28885 }
28886
28887 void  __attribute__((export_name("TS_OpenChannel_set_to_self_delay"))) TS_OpenChannel_set_to_self_delay(uint64_t this_ptr, int16_t val) {
28888         LDKOpenChannel this_ptr_conv;
28889         this_ptr_conv.inner = untag_ptr(this_ptr);
28890         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28892         this_ptr_conv.is_owned = false;
28893         OpenChannel_set_to_self_delay(&this_ptr_conv, val);
28894 }
28895
28896 int16_t  __attribute__((export_name("TS_OpenChannel_get_max_accepted_htlcs"))) TS_OpenChannel_get_max_accepted_htlcs(uint64_t this_ptr) {
28897         LDKOpenChannel this_ptr_conv;
28898         this_ptr_conv.inner = untag_ptr(this_ptr);
28899         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28901         this_ptr_conv.is_owned = false;
28902         int16_t ret_conv = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
28903         return ret_conv;
28904 }
28905
28906 void  __attribute__((export_name("TS_OpenChannel_set_max_accepted_htlcs"))) TS_OpenChannel_set_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
28907         LDKOpenChannel this_ptr_conv;
28908         this_ptr_conv.inner = untag_ptr(this_ptr);
28909         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28911         this_ptr_conv.is_owned = false;
28912         OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
28913 }
28914
28915 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_funding_pubkey"))) TS_OpenChannel_get_funding_pubkey(uint64_t this_ptr) {
28916         LDKOpenChannel this_ptr_conv;
28917         this_ptr_conv.inner = untag_ptr(this_ptr);
28918         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28920         this_ptr_conv.is_owned = false;
28921         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
28922         memcpy(ret_arr->elems, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
28923         return ret_arr;
28924 }
28925
28926 void  __attribute__((export_name("TS_OpenChannel_set_funding_pubkey"))) TS_OpenChannel_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
28927         LDKOpenChannel this_ptr_conv;
28928         this_ptr_conv.inner = untag_ptr(this_ptr);
28929         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28931         this_ptr_conv.is_owned = false;
28932         LDKPublicKey val_ref;
28933         CHECK(val->arr_len == 33);
28934         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
28935         OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
28936 }
28937
28938 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_revocation_basepoint"))) TS_OpenChannel_get_revocation_basepoint(uint64_t this_ptr) {
28939         LDKOpenChannel this_ptr_conv;
28940         this_ptr_conv.inner = untag_ptr(this_ptr);
28941         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28943         this_ptr_conv.is_owned = false;
28944         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
28945         memcpy(ret_arr->elems, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
28946         return ret_arr;
28947 }
28948
28949 void  __attribute__((export_name("TS_OpenChannel_set_revocation_basepoint"))) TS_OpenChannel_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
28950         LDKOpenChannel this_ptr_conv;
28951         this_ptr_conv.inner = untag_ptr(this_ptr);
28952         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28954         this_ptr_conv.is_owned = false;
28955         LDKPublicKey val_ref;
28956         CHECK(val->arr_len == 33);
28957         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
28958         OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
28959 }
28960
28961 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_payment_point"))) TS_OpenChannel_get_payment_point(uint64_t this_ptr) {
28962         LDKOpenChannel this_ptr_conv;
28963         this_ptr_conv.inner = untag_ptr(this_ptr);
28964         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28966         this_ptr_conv.is_owned = false;
28967         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
28968         memcpy(ret_arr->elems, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
28969         return ret_arr;
28970 }
28971
28972 void  __attribute__((export_name("TS_OpenChannel_set_payment_point"))) TS_OpenChannel_set_payment_point(uint64_t this_ptr, int8_tArray val) {
28973         LDKOpenChannel this_ptr_conv;
28974         this_ptr_conv.inner = untag_ptr(this_ptr);
28975         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28977         this_ptr_conv.is_owned = false;
28978         LDKPublicKey val_ref;
28979         CHECK(val->arr_len == 33);
28980         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
28981         OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
28982 }
28983
28984 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_delayed_payment_basepoint"))) TS_OpenChannel_get_delayed_payment_basepoint(uint64_t this_ptr) {
28985         LDKOpenChannel this_ptr_conv;
28986         this_ptr_conv.inner = untag_ptr(this_ptr);
28987         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28989         this_ptr_conv.is_owned = false;
28990         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
28991         memcpy(ret_arr->elems, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
28992         return ret_arr;
28993 }
28994
28995 void  __attribute__((export_name("TS_OpenChannel_set_delayed_payment_basepoint"))) TS_OpenChannel_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
28996         LDKOpenChannel this_ptr_conv;
28997         this_ptr_conv.inner = untag_ptr(this_ptr);
28998         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29000         this_ptr_conv.is_owned = false;
29001         LDKPublicKey val_ref;
29002         CHECK(val->arr_len == 33);
29003         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29004         OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
29005 }
29006
29007 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_htlc_basepoint"))) TS_OpenChannel_get_htlc_basepoint(uint64_t this_ptr) {
29008         LDKOpenChannel this_ptr_conv;
29009         this_ptr_conv.inner = untag_ptr(this_ptr);
29010         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29012         this_ptr_conv.is_owned = false;
29013         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29014         memcpy(ret_arr->elems, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
29015         return ret_arr;
29016 }
29017
29018 void  __attribute__((export_name("TS_OpenChannel_set_htlc_basepoint"))) TS_OpenChannel_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
29019         LDKOpenChannel this_ptr_conv;
29020         this_ptr_conv.inner = untag_ptr(this_ptr);
29021         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29023         this_ptr_conv.is_owned = false;
29024         LDKPublicKey val_ref;
29025         CHECK(val->arr_len == 33);
29026         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29027         OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
29028 }
29029
29030 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_first_per_commitment_point"))) TS_OpenChannel_get_first_per_commitment_point(uint64_t this_ptr) {
29031         LDKOpenChannel this_ptr_conv;
29032         this_ptr_conv.inner = untag_ptr(this_ptr);
29033         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29035         this_ptr_conv.is_owned = false;
29036         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29037         memcpy(ret_arr->elems, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
29038         return ret_arr;
29039 }
29040
29041 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) {
29042         LDKOpenChannel this_ptr_conv;
29043         this_ptr_conv.inner = untag_ptr(this_ptr);
29044         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29046         this_ptr_conv.is_owned = false;
29047         LDKPublicKey val_ref;
29048         CHECK(val->arr_len == 33);
29049         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29050         OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
29051 }
29052
29053 int8_t  __attribute__((export_name("TS_OpenChannel_get_channel_flags"))) TS_OpenChannel_get_channel_flags(uint64_t this_ptr) {
29054         LDKOpenChannel this_ptr_conv;
29055         this_ptr_conv.inner = untag_ptr(this_ptr);
29056         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29058         this_ptr_conv.is_owned = false;
29059         int8_t ret_conv = OpenChannel_get_channel_flags(&this_ptr_conv);
29060         return ret_conv;
29061 }
29062
29063 void  __attribute__((export_name("TS_OpenChannel_set_channel_flags"))) TS_OpenChannel_set_channel_flags(uint64_t this_ptr, int8_t val) {
29064         LDKOpenChannel this_ptr_conv;
29065         this_ptr_conv.inner = untag_ptr(this_ptr);
29066         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29068         this_ptr_conv.is_owned = false;
29069         OpenChannel_set_channel_flags(&this_ptr_conv, val);
29070 }
29071
29072 uint64_t  __attribute__((export_name("TS_OpenChannel_get_channel_type"))) TS_OpenChannel_get_channel_type(uint64_t this_ptr) {
29073         LDKOpenChannel this_ptr_conv;
29074         this_ptr_conv.inner = untag_ptr(this_ptr);
29075         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29077         this_ptr_conv.is_owned = false;
29078         LDKChannelTypeFeatures ret_var = OpenChannel_get_channel_type(&this_ptr_conv);
29079         uint64_t ret_ref = 0;
29080         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29081         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29082         return ret_ref;
29083 }
29084
29085 void  __attribute__((export_name("TS_OpenChannel_set_channel_type"))) TS_OpenChannel_set_channel_type(uint64_t this_ptr, uint64_t val) {
29086         LDKOpenChannel this_ptr_conv;
29087         this_ptr_conv.inner = untag_ptr(this_ptr);
29088         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29090         this_ptr_conv.is_owned = false;
29091         LDKChannelTypeFeatures val_conv;
29092         val_conv.inner = untag_ptr(val);
29093         val_conv.is_owned = ptr_is_owned(val);
29094         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29095         val_conv = ChannelTypeFeatures_clone(&val_conv);
29096         OpenChannel_set_channel_type(&this_ptr_conv, val_conv);
29097 }
29098
29099 static inline uint64_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
29100         LDKOpenChannel ret_var = OpenChannel_clone(arg);
29101         uint64_t ret_ref = 0;
29102         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29103         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29104         return ret_ref;
29105 }
29106 int64_t  __attribute__((export_name("TS_OpenChannel_clone_ptr"))) TS_OpenChannel_clone_ptr(uint64_t arg) {
29107         LDKOpenChannel arg_conv;
29108         arg_conv.inner = untag_ptr(arg);
29109         arg_conv.is_owned = ptr_is_owned(arg);
29110         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29111         arg_conv.is_owned = false;
29112         int64_t ret_conv = OpenChannel_clone_ptr(&arg_conv);
29113         return ret_conv;
29114 }
29115
29116 uint64_t  __attribute__((export_name("TS_OpenChannel_clone"))) TS_OpenChannel_clone(uint64_t orig) {
29117         LDKOpenChannel orig_conv;
29118         orig_conv.inner = untag_ptr(orig);
29119         orig_conv.is_owned = ptr_is_owned(orig);
29120         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29121         orig_conv.is_owned = false;
29122         LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
29123         uint64_t ret_ref = 0;
29124         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29125         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29126         return ret_ref;
29127 }
29128
29129 void  __attribute__((export_name("TS_AcceptChannel_free"))) TS_AcceptChannel_free(uint64_t this_obj) {
29130         LDKAcceptChannel this_obj_conv;
29131         this_obj_conv.inner = untag_ptr(this_obj);
29132         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29134         AcceptChannel_free(this_obj_conv);
29135 }
29136
29137 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_temporary_channel_id"))) TS_AcceptChannel_get_temporary_channel_id(uint64_t this_ptr) {
29138         LDKAcceptChannel this_ptr_conv;
29139         this_ptr_conv.inner = untag_ptr(this_ptr);
29140         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29142         this_ptr_conv.is_owned = false;
29143         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29144         memcpy(ret_arr->elems, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv), 32);
29145         return ret_arr;
29146 }
29147
29148 void  __attribute__((export_name("TS_AcceptChannel_set_temporary_channel_id"))) TS_AcceptChannel_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
29149         LDKAcceptChannel this_ptr_conv;
29150         this_ptr_conv.inner = untag_ptr(this_ptr);
29151         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29153         this_ptr_conv.is_owned = false;
29154         LDKThirtyTwoBytes val_ref;
29155         CHECK(val->arr_len == 32);
29156         memcpy(val_ref.data, val->elems, 32); FREE(val);
29157         AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
29158 }
29159
29160 int64_t  __attribute__((export_name("TS_AcceptChannel_get_dust_limit_satoshis"))) TS_AcceptChannel_get_dust_limit_satoshis(uint64_t this_ptr) {
29161         LDKAcceptChannel this_ptr_conv;
29162         this_ptr_conv.inner = untag_ptr(this_ptr);
29163         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29165         this_ptr_conv.is_owned = false;
29166         int64_t ret_conv = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
29167         return ret_conv;
29168 }
29169
29170 void  __attribute__((export_name("TS_AcceptChannel_set_dust_limit_satoshis"))) TS_AcceptChannel_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
29171         LDKAcceptChannel this_ptr_conv;
29172         this_ptr_conv.inner = untag_ptr(this_ptr);
29173         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29175         this_ptr_conv.is_owned = false;
29176         AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
29177 }
29178
29179 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) {
29180         LDKAcceptChannel this_ptr_conv;
29181         this_ptr_conv.inner = untag_ptr(this_ptr);
29182         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29183         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29184         this_ptr_conv.is_owned = false;
29185         int64_t ret_conv = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
29186         return ret_conv;
29187 }
29188
29189 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) {
29190         LDKAcceptChannel this_ptr_conv;
29191         this_ptr_conv.inner = untag_ptr(this_ptr);
29192         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29194         this_ptr_conv.is_owned = false;
29195         AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
29196 }
29197
29198 int64_t  __attribute__((export_name("TS_AcceptChannel_get_channel_reserve_satoshis"))) TS_AcceptChannel_get_channel_reserve_satoshis(uint64_t this_ptr) {
29199         LDKAcceptChannel this_ptr_conv;
29200         this_ptr_conv.inner = untag_ptr(this_ptr);
29201         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29203         this_ptr_conv.is_owned = false;
29204         int64_t ret_conv = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
29205         return ret_conv;
29206 }
29207
29208 void  __attribute__((export_name("TS_AcceptChannel_set_channel_reserve_satoshis"))) TS_AcceptChannel_set_channel_reserve_satoshis(uint64_t this_ptr, int64_t val) {
29209         LDKAcceptChannel this_ptr_conv;
29210         this_ptr_conv.inner = untag_ptr(this_ptr);
29211         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29213         this_ptr_conv.is_owned = false;
29214         AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
29215 }
29216
29217 int64_t  __attribute__((export_name("TS_AcceptChannel_get_htlc_minimum_msat"))) TS_AcceptChannel_get_htlc_minimum_msat(uint64_t this_ptr) {
29218         LDKAcceptChannel this_ptr_conv;
29219         this_ptr_conv.inner = untag_ptr(this_ptr);
29220         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29222         this_ptr_conv.is_owned = false;
29223         int64_t ret_conv = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
29224         return ret_conv;
29225 }
29226
29227 void  __attribute__((export_name("TS_AcceptChannel_set_htlc_minimum_msat"))) TS_AcceptChannel_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
29228         LDKAcceptChannel this_ptr_conv;
29229         this_ptr_conv.inner = untag_ptr(this_ptr);
29230         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29232         this_ptr_conv.is_owned = false;
29233         AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
29234 }
29235
29236 int32_t  __attribute__((export_name("TS_AcceptChannel_get_minimum_depth"))) TS_AcceptChannel_get_minimum_depth(uint64_t this_ptr) {
29237         LDKAcceptChannel this_ptr_conv;
29238         this_ptr_conv.inner = untag_ptr(this_ptr);
29239         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29241         this_ptr_conv.is_owned = false;
29242         int32_t ret_conv = AcceptChannel_get_minimum_depth(&this_ptr_conv);
29243         return ret_conv;
29244 }
29245
29246 void  __attribute__((export_name("TS_AcceptChannel_set_minimum_depth"))) TS_AcceptChannel_set_minimum_depth(uint64_t this_ptr, int32_t val) {
29247         LDKAcceptChannel this_ptr_conv;
29248         this_ptr_conv.inner = untag_ptr(this_ptr);
29249         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29251         this_ptr_conv.is_owned = false;
29252         AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
29253 }
29254
29255 int16_t  __attribute__((export_name("TS_AcceptChannel_get_to_self_delay"))) TS_AcceptChannel_get_to_self_delay(uint64_t this_ptr) {
29256         LDKAcceptChannel this_ptr_conv;
29257         this_ptr_conv.inner = untag_ptr(this_ptr);
29258         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29260         this_ptr_conv.is_owned = false;
29261         int16_t ret_conv = AcceptChannel_get_to_self_delay(&this_ptr_conv);
29262         return ret_conv;
29263 }
29264
29265 void  __attribute__((export_name("TS_AcceptChannel_set_to_self_delay"))) TS_AcceptChannel_set_to_self_delay(uint64_t this_ptr, int16_t val) {
29266         LDKAcceptChannel this_ptr_conv;
29267         this_ptr_conv.inner = untag_ptr(this_ptr);
29268         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29270         this_ptr_conv.is_owned = false;
29271         AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
29272 }
29273
29274 int16_t  __attribute__((export_name("TS_AcceptChannel_get_max_accepted_htlcs"))) TS_AcceptChannel_get_max_accepted_htlcs(uint64_t this_ptr) {
29275         LDKAcceptChannel this_ptr_conv;
29276         this_ptr_conv.inner = untag_ptr(this_ptr);
29277         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29279         this_ptr_conv.is_owned = false;
29280         int16_t ret_conv = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
29281         return ret_conv;
29282 }
29283
29284 void  __attribute__((export_name("TS_AcceptChannel_set_max_accepted_htlcs"))) TS_AcceptChannel_set_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
29285         LDKAcceptChannel this_ptr_conv;
29286         this_ptr_conv.inner = untag_ptr(this_ptr);
29287         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29289         this_ptr_conv.is_owned = false;
29290         AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
29291 }
29292
29293 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_funding_pubkey"))) TS_AcceptChannel_get_funding_pubkey(uint64_t this_ptr) {
29294         LDKAcceptChannel this_ptr_conv;
29295         this_ptr_conv.inner = untag_ptr(this_ptr);
29296         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29297         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29298         this_ptr_conv.is_owned = false;
29299         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29300         memcpy(ret_arr->elems, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
29301         return ret_arr;
29302 }
29303
29304 void  __attribute__((export_name("TS_AcceptChannel_set_funding_pubkey"))) TS_AcceptChannel_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
29305         LDKAcceptChannel this_ptr_conv;
29306         this_ptr_conv.inner = untag_ptr(this_ptr);
29307         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29309         this_ptr_conv.is_owned = false;
29310         LDKPublicKey val_ref;
29311         CHECK(val->arr_len == 33);
29312         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29313         AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
29314 }
29315
29316 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_revocation_basepoint"))) TS_AcceptChannel_get_revocation_basepoint(uint64_t this_ptr) {
29317         LDKAcceptChannel this_ptr_conv;
29318         this_ptr_conv.inner = untag_ptr(this_ptr);
29319         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29321         this_ptr_conv.is_owned = false;
29322         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29323         memcpy(ret_arr->elems, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
29324         return ret_arr;
29325 }
29326
29327 void  __attribute__((export_name("TS_AcceptChannel_set_revocation_basepoint"))) TS_AcceptChannel_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
29328         LDKAcceptChannel this_ptr_conv;
29329         this_ptr_conv.inner = untag_ptr(this_ptr);
29330         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29332         this_ptr_conv.is_owned = false;
29333         LDKPublicKey val_ref;
29334         CHECK(val->arr_len == 33);
29335         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29336         AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
29337 }
29338
29339 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_payment_point"))) TS_AcceptChannel_get_payment_point(uint64_t this_ptr) {
29340         LDKAcceptChannel this_ptr_conv;
29341         this_ptr_conv.inner = untag_ptr(this_ptr);
29342         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29344         this_ptr_conv.is_owned = false;
29345         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29346         memcpy(ret_arr->elems, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
29347         return ret_arr;
29348 }
29349
29350 void  __attribute__((export_name("TS_AcceptChannel_set_payment_point"))) TS_AcceptChannel_set_payment_point(uint64_t this_ptr, int8_tArray val) {
29351         LDKAcceptChannel this_ptr_conv;
29352         this_ptr_conv.inner = untag_ptr(this_ptr);
29353         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29354         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29355         this_ptr_conv.is_owned = false;
29356         LDKPublicKey val_ref;
29357         CHECK(val->arr_len == 33);
29358         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29359         AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
29360 }
29361
29362 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_delayed_payment_basepoint"))) TS_AcceptChannel_get_delayed_payment_basepoint(uint64_t this_ptr) {
29363         LDKAcceptChannel this_ptr_conv;
29364         this_ptr_conv.inner = untag_ptr(this_ptr);
29365         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29367         this_ptr_conv.is_owned = false;
29368         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29369         memcpy(ret_arr->elems, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
29370         return ret_arr;
29371 }
29372
29373 void  __attribute__((export_name("TS_AcceptChannel_set_delayed_payment_basepoint"))) TS_AcceptChannel_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
29374         LDKAcceptChannel this_ptr_conv;
29375         this_ptr_conv.inner = untag_ptr(this_ptr);
29376         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29378         this_ptr_conv.is_owned = false;
29379         LDKPublicKey val_ref;
29380         CHECK(val->arr_len == 33);
29381         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29382         AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
29383 }
29384
29385 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_htlc_basepoint"))) TS_AcceptChannel_get_htlc_basepoint(uint64_t this_ptr) {
29386         LDKAcceptChannel this_ptr_conv;
29387         this_ptr_conv.inner = untag_ptr(this_ptr);
29388         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29390         this_ptr_conv.is_owned = false;
29391         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29392         memcpy(ret_arr->elems, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
29393         return ret_arr;
29394 }
29395
29396 void  __attribute__((export_name("TS_AcceptChannel_set_htlc_basepoint"))) TS_AcceptChannel_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
29397         LDKAcceptChannel this_ptr_conv;
29398         this_ptr_conv.inner = untag_ptr(this_ptr);
29399         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29401         this_ptr_conv.is_owned = false;
29402         LDKPublicKey val_ref;
29403         CHECK(val->arr_len == 33);
29404         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29405         AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
29406 }
29407
29408 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_first_per_commitment_point"))) TS_AcceptChannel_get_first_per_commitment_point(uint64_t this_ptr) {
29409         LDKAcceptChannel this_ptr_conv;
29410         this_ptr_conv.inner = untag_ptr(this_ptr);
29411         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29413         this_ptr_conv.is_owned = false;
29414         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29415         memcpy(ret_arr->elems, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
29416         return ret_arr;
29417 }
29418
29419 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) {
29420         LDKAcceptChannel this_ptr_conv;
29421         this_ptr_conv.inner = untag_ptr(this_ptr);
29422         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29424         this_ptr_conv.is_owned = false;
29425         LDKPublicKey val_ref;
29426         CHECK(val->arr_len == 33);
29427         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29428         AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
29429 }
29430
29431 uint64_t  __attribute__((export_name("TS_AcceptChannel_get_channel_type"))) TS_AcceptChannel_get_channel_type(uint64_t this_ptr) {
29432         LDKAcceptChannel this_ptr_conv;
29433         this_ptr_conv.inner = untag_ptr(this_ptr);
29434         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29436         this_ptr_conv.is_owned = false;
29437         LDKChannelTypeFeatures ret_var = AcceptChannel_get_channel_type(&this_ptr_conv);
29438         uint64_t ret_ref = 0;
29439         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29440         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29441         return ret_ref;
29442 }
29443
29444 void  __attribute__((export_name("TS_AcceptChannel_set_channel_type"))) TS_AcceptChannel_set_channel_type(uint64_t this_ptr, uint64_t val) {
29445         LDKAcceptChannel this_ptr_conv;
29446         this_ptr_conv.inner = untag_ptr(this_ptr);
29447         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29449         this_ptr_conv.is_owned = false;
29450         LDKChannelTypeFeatures val_conv;
29451         val_conv.inner = untag_ptr(val);
29452         val_conv.is_owned = ptr_is_owned(val);
29453         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29454         val_conv = ChannelTypeFeatures_clone(&val_conv);
29455         AcceptChannel_set_channel_type(&this_ptr_conv, val_conv);
29456 }
29457
29458 static inline uint64_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
29459         LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
29460         uint64_t ret_ref = 0;
29461         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29462         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29463         return ret_ref;
29464 }
29465 int64_t  __attribute__((export_name("TS_AcceptChannel_clone_ptr"))) TS_AcceptChannel_clone_ptr(uint64_t arg) {
29466         LDKAcceptChannel arg_conv;
29467         arg_conv.inner = untag_ptr(arg);
29468         arg_conv.is_owned = ptr_is_owned(arg);
29469         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29470         arg_conv.is_owned = false;
29471         int64_t ret_conv = AcceptChannel_clone_ptr(&arg_conv);
29472         return ret_conv;
29473 }
29474
29475 uint64_t  __attribute__((export_name("TS_AcceptChannel_clone"))) TS_AcceptChannel_clone(uint64_t orig) {
29476         LDKAcceptChannel orig_conv;
29477         orig_conv.inner = untag_ptr(orig);
29478         orig_conv.is_owned = ptr_is_owned(orig);
29479         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29480         orig_conv.is_owned = false;
29481         LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
29482         uint64_t ret_ref = 0;
29483         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29484         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29485         return ret_ref;
29486 }
29487
29488 void  __attribute__((export_name("TS_FundingCreated_free"))) TS_FundingCreated_free(uint64_t this_obj) {
29489         LDKFundingCreated this_obj_conv;
29490         this_obj_conv.inner = untag_ptr(this_obj);
29491         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29493         FundingCreated_free(this_obj_conv);
29494 }
29495
29496 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_temporary_channel_id"))) TS_FundingCreated_get_temporary_channel_id(uint64_t this_ptr) {
29497         LDKFundingCreated this_ptr_conv;
29498         this_ptr_conv.inner = untag_ptr(this_ptr);
29499         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29501         this_ptr_conv.is_owned = false;
29502         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29503         memcpy(ret_arr->elems, *FundingCreated_get_temporary_channel_id(&this_ptr_conv), 32);
29504         return ret_arr;
29505 }
29506
29507 void  __attribute__((export_name("TS_FundingCreated_set_temporary_channel_id"))) TS_FundingCreated_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
29508         LDKFundingCreated this_ptr_conv;
29509         this_ptr_conv.inner = untag_ptr(this_ptr);
29510         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29512         this_ptr_conv.is_owned = false;
29513         LDKThirtyTwoBytes val_ref;
29514         CHECK(val->arr_len == 32);
29515         memcpy(val_ref.data, val->elems, 32); FREE(val);
29516         FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
29517 }
29518
29519 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_funding_txid"))) TS_FundingCreated_get_funding_txid(uint64_t this_ptr) {
29520         LDKFundingCreated this_ptr_conv;
29521         this_ptr_conv.inner = untag_ptr(this_ptr);
29522         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29524         this_ptr_conv.is_owned = false;
29525         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29526         memcpy(ret_arr->elems, *FundingCreated_get_funding_txid(&this_ptr_conv), 32);
29527         return ret_arr;
29528 }
29529
29530 void  __attribute__((export_name("TS_FundingCreated_set_funding_txid"))) TS_FundingCreated_set_funding_txid(uint64_t this_ptr, int8_tArray val) {
29531         LDKFundingCreated this_ptr_conv;
29532         this_ptr_conv.inner = untag_ptr(this_ptr);
29533         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29535         this_ptr_conv.is_owned = false;
29536         LDKThirtyTwoBytes val_ref;
29537         CHECK(val->arr_len == 32);
29538         memcpy(val_ref.data, val->elems, 32); FREE(val);
29539         FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
29540 }
29541
29542 int16_t  __attribute__((export_name("TS_FundingCreated_get_funding_output_index"))) TS_FundingCreated_get_funding_output_index(uint64_t this_ptr) {
29543         LDKFundingCreated this_ptr_conv;
29544         this_ptr_conv.inner = untag_ptr(this_ptr);
29545         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29547         this_ptr_conv.is_owned = false;
29548         int16_t ret_conv = FundingCreated_get_funding_output_index(&this_ptr_conv);
29549         return ret_conv;
29550 }
29551
29552 void  __attribute__((export_name("TS_FundingCreated_set_funding_output_index"))) TS_FundingCreated_set_funding_output_index(uint64_t this_ptr, int16_t val) {
29553         LDKFundingCreated this_ptr_conv;
29554         this_ptr_conv.inner = untag_ptr(this_ptr);
29555         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29557         this_ptr_conv.is_owned = false;
29558         FundingCreated_set_funding_output_index(&this_ptr_conv, val);
29559 }
29560
29561 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_signature"))) TS_FundingCreated_get_signature(uint64_t this_ptr) {
29562         LDKFundingCreated this_ptr_conv;
29563         this_ptr_conv.inner = untag_ptr(this_ptr);
29564         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29565         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29566         this_ptr_conv.is_owned = false;
29567         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
29568         memcpy(ret_arr->elems, FundingCreated_get_signature(&this_ptr_conv).compact_form, 64);
29569         return ret_arr;
29570 }
29571
29572 void  __attribute__((export_name("TS_FundingCreated_set_signature"))) TS_FundingCreated_set_signature(uint64_t this_ptr, int8_tArray val) {
29573         LDKFundingCreated this_ptr_conv;
29574         this_ptr_conv.inner = untag_ptr(this_ptr);
29575         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29576         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29577         this_ptr_conv.is_owned = false;
29578         LDKSignature val_ref;
29579         CHECK(val->arr_len == 64);
29580         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
29581         FundingCreated_set_signature(&this_ptr_conv, val_ref);
29582 }
29583
29584 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) {
29585         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
29586         CHECK(temporary_channel_id_arg->arr_len == 32);
29587         memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
29588         LDKThirtyTwoBytes funding_txid_arg_ref;
29589         CHECK(funding_txid_arg->arr_len == 32);
29590         memcpy(funding_txid_arg_ref.data, funding_txid_arg->elems, 32); FREE(funding_txid_arg);
29591         LDKSignature signature_arg_ref;
29592         CHECK(signature_arg->arr_len == 64);
29593         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
29594         LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
29595         uint64_t ret_ref = 0;
29596         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29597         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29598         return ret_ref;
29599 }
29600
29601 static inline uint64_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
29602         LDKFundingCreated ret_var = FundingCreated_clone(arg);
29603         uint64_t ret_ref = 0;
29604         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29605         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29606         return ret_ref;
29607 }
29608 int64_t  __attribute__((export_name("TS_FundingCreated_clone_ptr"))) TS_FundingCreated_clone_ptr(uint64_t arg) {
29609         LDKFundingCreated arg_conv;
29610         arg_conv.inner = untag_ptr(arg);
29611         arg_conv.is_owned = ptr_is_owned(arg);
29612         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29613         arg_conv.is_owned = false;
29614         int64_t ret_conv = FundingCreated_clone_ptr(&arg_conv);
29615         return ret_conv;
29616 }
29617
29618 uint64_t  __attribute__((export_name("TS_FundingCreated_clone"))) TS_FundingCreated_clone(uint64_t orig) {
29619         LDKFundingCreated orig_conv;
29620         orig_conv.inner = untag_ptr(orig);
29621         orig_conv.is_owned = ptr_is_owned(orig);
29622         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29623         orig_conv.is_owned = false;
29624         LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
29625         uint64_t ret_ref = 0;
29626         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29627         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29628         return ret_ref;
29629 }
29630
29631 void  __attribute__((export_name("TS_FundingSigned_free"))) TS_FundingSigned_free(uint64_t this_obj) {
29632         LDKFundingSigned this_obj_conv;
29633         this_obj_conv.inner = untag_ptr(this_obj);
29634         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29636         FundingSigned_free(this_obj_conv);
29637 }
29638
29639 int8_tArray  __attribute__((export_name("TS_FundingSigned_get_channel_id"))) TS_FundingSigned_get_channel_id(uint64_t this_ptr) {
29640         LDKFundingSigned this_ptr_conv;
29641         this_ptr_conv.inner = untag_ptr(this_ptr);
29642         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29644         this_ptr_conv.is_owned = false;
29645         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29646         memcpy(ret_arr->elems, *FundingSigned_get_channel_id(&this_ptr_conv), 32);
29647         return ret_arr;
29648 }
29649
29650 void  __attribute__((export_name("TS_FundingSigned_set_channel_id"))) TS_FundingSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
29651         LDKFundingSigned this_ptr_conv;
29652         this_ptr_conv.inner = untag_ptr(this_ptr);
29653         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29655         this_ptr_conv.is_owned = false;
29656         LDKThirtyTwoBytes val_ref;
29657         CHECK(val->arr_len == 32);
29658         memcpy(val_ref.data, val->elems, 32); FREE(val);
29659         FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
29660 }
29661
29662 int8_tArray  __attribute__((export_name("TS_FundingSigned_get_signature"))) TS_FundingSigned_get_signature(uint64_t this_ptr) {
29663         LDKFundingSigned this_ptr_conv;
29664         this_ptr_conv.inner = untag_ptr(this_ptr);
29665         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29666         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29667         this_ptr_conv.is_owned = false;
29668         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
29669         memcpy(ret_arr->elems, FundingSigned_get_signature(&this_ptr_conv).compact_form, 64);
29670         return ret_arr;
29671 }
29672
29673 void  __attribute__((export_name("TS_FundingSigned_set_signature"))) TS_FundingSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
29674         LDKFundingSigned this_ptr_conv;
29675         this_ptr_conv.inner = untag_ptr(this_ptr);
29676         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29678         this_ptr_conv.is_owned = false;
29679         LDKSignature val_ref;
29680         CHECK(val->arr_len == 64);
29681         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
29682         FundingSigned_set_signature(&this_ptr_conv, val_ref);
29683 }
29684
29685 uint64_t  __attribute__((export_name("TS_FundingSigned_new"))) TS_FundingSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg) {
29686         LDKThirtyTwoBytes channel_id_arg_ref;
29687         CHECK(channel_id_arg->arr_len == 32);
29688         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
29689         LDKSignature signature_arg_ref;
29690         CHECK(signature_arg->arr_len == 64);
29691         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
29692         LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
29693         uint64_t ret_ref = 0;
29694         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29695         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29696         return ret_ref;
29697 }
29698
29699 static inline uint64_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
29700         LDKFundingSigned ret_var = FundingSigned_clone(arg);
29701         uint64_t ret_ref = 0;
29702         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29703         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29704         return ret_ref;
29705 }
29706 int64_t  __attribute__((export_name("TS_FundingSigned_clone_ptr"))) TS_FundingSigned_clone_ptr(uint64_t arg) {
29707         LDKFundingSigned arg_conv;
29708         arg_conv.inner = untag_ptr(arg);
29709         arg_conv.is_owned = ptr_is_owned(arg);
29710         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29711         arg_conv.is_owned = false;
29712         int64_t ret_conv = FundingSigned_clone_ptr(&arg_conv);
29713         return ret_conv;
29714 }
29715
29716 uint64_t  __attribute__((export_name("TS_FundingSigned_clone"))) TS_FundingSigned_clone(uint64_t orig) {
29717         LDKFundingSigned orig_conv;
29718         orig_conv.inner = untag_ptr(orig);
29719         orig_conv.is_owned = ptr_is_owned(orig);
29720         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29721         orig_conv.is_owned = false;
29722         LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
29723         uint64_t ret_ref = 0;
29724         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29725         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29726         return ret_ref;
29727 }
29728
29729 void  __attribute__((export_name("TS_ChannelReady_free"))) TS_ChannelReady_free(uint64_t this_obj) {
29730         LDKChannelReady this_obj_conv;
29731         this_obj_conv.inner = untag_ptr(this_obj);
29732         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29734         ChannelReady_free(this_obj_conv);
29735 }
29736
29737 int8_tArray  __attribute__((export_name("TS_ChannelReady_get_channel_id"))) TS_ChannelReady_get_channel_id(uint64_t this_ptr) {
29738         LDKChannelReady this_ptr_conv;
29739         this_ptr_conv.inner = untag_ptr(this_ptr);
29740         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29742         this_ptr_conv.is_owned = false;
29743         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29744         memcpy(ret_arr->elems, *ChannelReady_get_channel_id(&this_ptr_conv), 32);
29745         return ret_arr;
29746 }
29747
29748 void  __attribute__((export_name("TS_ChannelReady_set_channel_id"))) TS_ChannelReady_set_channel_id(uint64_t this_ptr, int8_tArray val) {
29749         LDKChannelReady this_ptr_conv;
29750         this_ptr_conv.inner = untag_ptr(this_ptr);
29751         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29753         this_ptr_conv.is_owned = false;
29754         LDKThirtyTwoBytes val_ref;
29755         CHECK(val->arr_len == 32);
29756         memcpy(val_ref.data, val->elems, 32); FREE(val);
29757         ChannelReady_set_channel_id(&this_ptr_conv, val_ref);
29758 }
29759
29760 int8_tArray  __attribute__((export_name("TS_ChannelReady_get_next_per_commitment_point"))) TS_ChannelReady_get_next_per_commitment_point(uint64_t this_ptr) {
29761         LDKChannelReady this_ptr_conv;
29762         this_ptr_conv.inner = untag_ptr(this_ptr);
29763         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29765         this_ptr_conv.is_owned = false;
29766         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29767         memcpy(ret_arr->elems, ChannelReady_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
29768         return ret_arr;
29769 }
29770
29771 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) {
29772         LDKChannelReady this_ptr_conv;
29773         this_ptr_conv.inner = untag_ptr(this_ptr);
29774         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29776         this_ptr_conv.is_owned = false;
29777         LDKPublicKey val_ref;
29778         CHECK(val->arr_len == 33);
29779         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29780         ChannelReady_set_next_per_commitment_point(&this_ptr_conv, val_ref);
29781 }
29782
29783 uint64_t  __attribute__((export_name("TS_ChannelReady_get_short_channel_id_alias"))) TS_ChannelReady_get_short_channel_id_alias(uint64_t this_ptr) {
29784         LDKChannelReady this_ptr_conv;
29785         this_ptr_conv.inner = untag_ptr(this_ptr);
29786         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29788         this_ptr_conv.is_owned = false;
29789         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
29790         *ret_copy = ChannelReady_get_short_channel_id_alias(&this_ptr_conv);
29791         uint64_t ret_ref = tag_ptr(ret_copy, true);
29792         return ret_ref;
29793 }
29794
29795 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) {
29796         LDKChannelReady this_ptr_conv;
29797         this_ptr_conv.inner = untag_ptr(this_ptr);
29798         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29800         this_ptr_conv.is_owned = false;
29801         void* val_ptr = untag_ptr(val);
29802         CHECK_ACCESS(val_ptr);
29803         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
29804         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
29805         ChannelReady_set_short_channel_id_alias(&this_ptr_conv, val_conv);
29806 }
29807
29808 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) {
29809         LDKThirtyTwoBytes channel_id_arg_ref;
29810         CHECK(channel_id_arg->arr_len == 32);
29811         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
29812         LDKPublicKey next_per_commitment_point_arg_ref;
29813         CHECK(next_per_commitment_point_arg->arr_len == 33);
29814         memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
29815         void* short_channel_id_alias_arg_ptr = untag_ptr(short_channel_id_alias_arg);
29816         CHECK_ACCESS(short_channel_id_alias_arg_ptr);
29817         LDKCOption_u64Z short_channel_id_alias_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_alias_arg_ptr);
29818         short_channel_id_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_alias_arg));
29819         LDKChannelReady ret_var = ChannelReady_new(channel_id_arg_ref, next_per_commitment_point_arg_ref, short_channel_id_alias_arg_conv);
29820         uint64_t ret_ref = 0;
29821         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29822         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29823         return ret_ref;
29824 }
29825
29826 static inline uint64_t ChannelReady_clone_ptr(LDKChannelReady *NONNULL_PTR arg) {
29827         LDKChannelReady ret_var = ChannelReady_clone(arg);
29828         uint64_t ret_ref = 0;
29829         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29830         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29831         return ret_ref;
29832 }
29833 int64_t  __attribute__((export_name("TS_ChannelReady_clone_ptr"))) TS_ChannelReady_clone_ptr(uint64_t arg) {
29834         LDKChannelReady arg_conv;
29835         arg_conv.inner = untag_ptr(arg);
29836         arg_conv.is_owned = ptr_is_owned(arg);
29837         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29838         arg_conv.is_owned = false;
29839         int64_t ret_conv = ChannelReady_clone_ptr(&arg_conv);
29840         return ret_conv;
29841 }
29842
29843 uint64_t  __attribute__((export_name("TS_ChannelReady_clone"))) TS_ChannelReady_clone(uint64_t orig) {
29844         LDKChannelReady orig_conv;
29845         orig_conv.inner = untag_ptr(orig);
29846         orig_conv.is_owned = ptr_is_owned(orig);
29847         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29848         orig_conv.is_owned = false;
29849         LDKChannelReady ret_var = ChannelReady_clone(&orig_conv);
29850         uint64_t ret_ref = 0;
29851         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29852         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29853         return ret_ref;
29854 }
29855
29856 void  __attribute__((export_name("TS_Shutdown_free"))) TS_Shutdown_free(uint64_t this_obj) {
29857         LDKShutdown this_obj_conv;
29858         this_obj_conv.inner = untag_ptr(this_obj);
29859         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29861         Shutdown_free(this_obj_conv);
29862 }
29863
29864 int8_tArray  __attribute__((export_name("TS_Shutdown_get_channel_id"))) TS_Shutdown_get_channel_id(uint64_t this_ptr) {
29865         LDKShutdown this_ptr_conv;
29866         this_ptr_conv.inner = untag_ptr(this_ptr);
29867         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29869         this_ptr_conv.is_owned = false;
29870         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29871         memcpy(ret_arr->elems, *Shutdown_get_channel_id(&this_ptr_conv), 32);
29872         return ret_arr;
29873 }
29874
29875 void  __attribute__((export_name("TS_Shutdown_set_channel_id"))) TS_Shutdown_set_channel_id(uint64_t this_ptr, int8_tArray val) {
29876         LDKShutdown this_ptr_conv;
29877         this_ptr_conv.inner = untag_ptr(this_ptr);
29878         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29880         this_ptr_conv.is_owned = false;
29881         LDKThirtyTwoBytes val_ref;
29882         CHECK(val->arr_len == 32);
29883         memcpy(val_ref.data, val->elems, 32); FREE(val);
29884         Shutdown_set_channel_id(&this_ptr_conv, val_ref);
29885 }
29886
29887 int8_tArray  __attribute__((export_name("TS_Shutdown_get_scriptpubkey"))) TS_Shutdown_get_scriptpubkey(uint64_t this_ptr) {
29888         LDKShutdown this_ptr_conv;
29889         this_ptr_conv.inner = untag_ptr(this_ptr);
29890         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29892         this_ptr_conv.is_owned = false;
29893         LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
29894         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29895         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29896         return ret_arr;
29897 }
29898
29899 void  __attribute__((export_name("TS_Shutdown_set_scriptpubkey"))) TS_Shutdown_set_scriptpubkey(uint64_t this_ptr, int8_tArray val) {
29900         LDKShutdown this_ptr_conv;
29901         this_ptr_conv.inner = untag_ptr(this_ptr);
29902         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29904         this_ptr_conv.is_owned = false;
29905         LDKCVec_u8Z val_ref;
29906         val_ref.datalen = val->arr_len;
29907         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
29908         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
29909         Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
29910 }
29911
29912 uint64_t  __attribute__((export_name("TS_Shutdown_new"))) TS_Shutdown_new(int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
29913         LDKThirtyTwoBytes channel_id_arg_ref;
29914         CHECK(channel_id_arg->arr_len == 32);
29915         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
29916         LDKCVec_u8Z scriptpubkey_arg_ref;
29917         scriptpubkey_arg_ref.datalen = scriptpubkey_arg->arr_len;
29918         scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
29919         memcpy(scriptpubkey_arg_ref.data, scriptpubkey_arg->elems, scriptpubkey_arg_ref.datalen); FREE(scriptpubkey_arg);
29920         LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
29921         uint64_t ret_ref = 0;
29922         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29923         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29924         return ret_ref;
29925 }
29926
29927 static inline uint64_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
29928         LDKShutdown ret_var = Shutdown_clone(arg);
29929         uint64_t ret_ref = 0;
29930         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29931         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29932         return ret_ref;
29933 }
29934 int64_t  __attribute__((export_name("TS_Shutdown_clone_ptr"))) TS_Shutdown_clone_ptr(uint64_t arg) {
29935         LDKShutdown arg_conv;
29936         arg_conv.inner = untag_ptr(arg);
29937         arg_conv.is_owned = ptr_is_owned(arg);
29938         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29939         arg_conv.is_owned = false;
29940         int64_t ret_conv = Shutdown_clone_ptr(&arg_conv);
29941         return ret_conv;
29942 }
29943
29944 uint64_t  __attribute__((export_name("TS_Shutdown_clone"))) TS_Shutdown_clone(uint64_t orig) {
29945         LDKShutdown orig_conv;
29946         orig_conv.inner = untag_ptr(orig);
29947         orig_conv.is_owned = ptr_is_owned(orig);
29948         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29949         orig_conv.is_owned = false;
29950         LDKShutdown ret_var = Shutdown_clone(&orig_conv);
29951         uint64_t ret_ref = 0;
29952         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29953         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29954         return ret_ref;
29955 }
29956
29957 void  __attribute__((export_name("TS_ClosingSignedFeeRange_free"))) TS_ClosingSignedFeeRange_free(uint64_t this_obj) {
29958         LDKClosingSignedFeeRange this_obj_conv;
29959         this_obj_conv.inner = untag_ptr(this_obj);
29960         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29962         ClosingSignedFeeRange_free(this_obj_conv);
29963 }
29964
29965 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_get_min_fee_satoshis"))) TS_ClosingSignedFeeRange_get_min_fee_satoshis(uint64_t this_ptr) {
29966         LDKClosingSignedFeeRange this_ptr_conv;
29967         this_ptr_conv.inner = untag_ptr(this_ptr);
29968         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29970         this_ptr_conv.is_owned = false;
29971         int64_t ret_conv = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
29972         return ret_conv;
29973 }
29974
29975 void  __attribute__((export_name("TS_ClosingSignedFeeRange_set_min_fee_satoshis"))) TS_ClosingSignedFeeRange_set_min_fee_satoshis(uint64_t this_ptr, int64_t val) {
29976         LDKClosingSignedFeeRange this_ptr_conv;
29977         this_ptr_conv.inner = untag_ptr(this_ptr);
29978         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29980         this_ptr_conv.is_owned = false;
29981         ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
29982 }
29983
29984 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_get_max_fee_satoshis"))) TS_ClosingSignedFeeRange_get_max_fee_satoshis(uint64_t this_ptr) {
29985         LDKClosingSignedFeeRange this_ptr_conv;
29986         this_ptr_conv.inner = untag_ptr(this_ptr);
29987         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29989         this_ptr_conv.is_owned = false;
29990         int64_t ret_conv = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
29991         return ret_conv;
29992 }
29993
29994 void  __attribute__((export_name("TS_ClosingSignedFeeRange_set_max_fee_satoshis"))) TS_ClosingSignedFeeRange_set_max_fee_satoshis(uint64_t this_ptr, int64_t val) {
29995         LDKClosingSignedFeeRange this_ptr_conv;
29996         this_ptr_conv.inner = untag_ptr(this_ptr);
29997         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29999         this_ptr_conv.is_owned = false;
30000         ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
30001 }
30002
30003 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_new"))) TS_ClosingSignedFeeRange_new(int64_t min_fee_satoshis_arg, int64_t max_fee_satoshis_arg) {
30004         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
30005         uint64_t ret_ref = 0;
30006         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30007         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30008         return ret_ref;
30009 }
30010
30011 static inline uint64_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
30012         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
30013         uint64_t ret_ref = 0;
30014         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30015         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30016         return ret_ref;
30017 }
30018 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_clone_ptr"))) TS_ClosingSignedFeeRange_clone_ptr(uint64_t arg) {
30019         LDKClosingSignedFeeRange arg_conv;
30020         arg_conv.inner = untag_ptr(arg);
30021         arg_conv.is_owned = ptr_is_owned(arg);
30022         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30023         arg_conv.is_owned = false;
30024         int64_t ret_conv = ClosingSignedFeeRange_clone_ptr(&arg_conv);
30025         return ret_conv;
30026 }
30027
30028 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_clone"))) TS_ClosingSignedFeeRange_clone(uint64_t orig) {
30029         LDKClosingSignedFeeRange orig_conv;
30030         orig_conv.inner = untag_ptr(orig);
30031         orig_conv.is_owned = ptr_is_owned(orig);
30032         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30033         orig_conv.is_owned = false;
30034         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
30035         uint64_t ret_ref = 0;
30036         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30037         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30038         return ret_ref;
30039 }
30040
30041 void  __attribute__((export_name("TS_ClosingSigned_free"))) TS_ClosingSigned_free(uint64_t this_obj) {
30042         LDKClosingSigned this_obj_conv;
30043         this_obj_conv.inner = untag_ptr(this_obj);
30044         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30046         ClosingSigned_free(this_obj_conv);
30047 }
30048
30049 int8_tArray  __attribute__((export_name("TS_ClosingSigned_get_channel_id"))) TS_ClosingSigned_get_channel_id(uint64_t this_ptr) {
30050         LDKClosingSigned this_ptr_conv;
30051         this_ptr_conv.inner = untag_ptr(this_ptr);
30052         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30054         this_ptr_conv.is_owned = false;
30055         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30056         memcpy(ret_arr->elems, *ClosingSigned_get_channel_id(&this_ptr_conv), 32);
30057         return ret_arr;
30058 }
30059
30060 void  __attribute__((export_name("TS_ClosingSigned_set_channel_id"))) TS_ClosingSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
30061         LDKClosingSigned this_ptr_conv;
30062         this_ptr_conv.inner = untag_ptr(this_ptr);
30063         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30065         this_ptr_conv.is_owned = false;
30066         LDKThirtyTwoBytes val_ref;
30067         CHECK(val->arr_len == 32);
30068         memcpy(val_ref.data, val->elems, 32); FREE(val);
30069         ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
30070 }
30071
30072 int64_t  __attribute__((export_name("TS_ClosingSigned_get_fee_satoshis"))) TS_ClosingSigned_get_fee_satoshis(uint64_t this_ptr) {
30073         LDKClosingSigned this_ptr_conv;
30074         this_ptr_conv.inner = untag_ptr(this_ptr);
30075         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30077         this_ptr_conv.is_owned = false;
30078         int64_t ret_conv = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
30079         return ret_conv;
30080 }
30081
30082 void  __attribute__((export_name("TS_ClosingSigned_set_fee_satoshis"))) TS_ClosingSigned_set_fee_satoshis(uint64_t this_ptr, int64_t val) {
30083         LDKClosingSigned this_ptr_conv;
30084         this_ptr_conv.inner = untag_ptr(this_ptr);
30085         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30087         this_ptr_conv.is_owned = false;
30088         ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
30089 }
30090
30091 int8_tArray  __attribute__((export_name("TS_ClosingSigned_get_signature"))) TS_ClosingSigned_get_signature(uint64_t this_ptr) {
30092         LDKClosingSigned this_ptr_conv;
30093         this_ptr_conv.inner = untag_ptr(this_ptr);
30094         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30096         this_ptr_conv.is_owned = false;
30097         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
30098         memcpy(ret_arr->elems, ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64);
30099         return ret_arr;
30100 }
30101
30102 void  __attribute__((export_name("TS_ClosingSigned_set_signature"))) TS_ClosingSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
30103         LDKClosingSigned this_ptr_conv;
30104         this_ptr_conv.inner = untag_ptr(this_ptr);
30105         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30107         this_ptr_conv.is_owned = false;
30108         LDKSignature val_ref;
30109         CHECK(val->arr_len == 64);
30110         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
30111         ClosingSigned_set_signature(&this_ptr_conv, val_ref);
30112 }
30113
30114 uint64_t  __attribute__((export_name("TS_ClosingSigned_get_fee_range"))) TS_ClosingSigned_get_fee_range(uint64_t this_ptr) {
30115         LDKClosingSigned this_ptr_conv;
30116         this_ptr_conv.inner = untag_ptr(this_ptr);
30117         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30119         this_ptr_conv.is_owned = false;
30120         LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
30121         uint64_t ret_ref = 0;
30122         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30123         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30124         return ret_ref;
30125 }
30126
30127 void  __attribute__((export_name("TS_ClosingSigned_set_fee_range"))) TS_ClosingSigned_set_fee_range(uint64_t this_ptr, uint64_t val) {
30128         LDKClosingSigned this_ptr_conv;
30129         this_ptr_conv.inner = untag_ptr(this_ptr);
30130         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30131         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30132         this_ptr_conv.is_owned = false;
30133         LDKClosingSignedFeeRange val_conv;
30134         val_conv.inner = untag_ptr(val);
30135         val_conv.is_owned = ptr_is_owned(val);
30136         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30137         val_conv = ClosingSignedFeeRange_clone(&val_conv);
30138         ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
30139 }
30140
30141 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) {
30142         LDKThirtyTwoBytes channel_id_arg_ref;
30143         CHECK(channel_id_arg->arr_len == 32);
30144         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
30145         LDKSignature signature_arg_ref;
30146         CHECK(signature_arg->arr_len == 64);
30147         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
30148         LDKClosingSignedFeeRange fee_range_arg_conv;
30149         fee_range_arg_conv.inner = untag_ptr(fee_range_arg);
30150         fee_range_arg_conv.is_owned = ptr_is_owned(fee_range_arg);
30151         CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
30152         fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
30153         LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
30154         uint64_t ret_ref = 0;
30155         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30156         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30157         return ret_ref;
30158 }
30159
30160 static inline uint64_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
30161         LDKClosingSigned ret_var = ClosingSigned_clone(arg);
30162         uint64_t ret_ref = 0;
30163         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30164         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30165         return ret_ref;
30166 }
30167 int64_t  __attribute__((export_name("TS_ClosingSigned_clone_ptr"))) TS_ClosingSigned_clone_ptr(uint64_t arg) {
30168         LDKClosingSigned arg_conv;
30169         arg_conv.inner = untag_ptr(arg);
30170         arg_conv.is_owned = ptr_is_owned(arg);
30171         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30172         arg_conv.is_owned = false;
30173         int64_t ret_conv = ClosingSigned_clone_ptr(&arg_conv);
30174         return ret_conv;
30175 }
30176
30177 uint64_t  __attribute__((export_name("TS_ClosingSigned_clone"))) TS_ClosingSigned_clone(uint64_t orig) {
30178         LDKClosingSigned orig_conv;
30179         orig_conv.inner = untag_ptr(orig);
30180         orig_conv.is_owned = ptr_is_owned(orig);
30181         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30182         orig_conv.is_owned = false;
30183         LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
30184         uint64_t ret_ref = 0;
30185         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30186         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30187         return ret_ref;
30188 }
30189
30190 void  __attribute__((export_name("TS_UpdateAddHTLC_free"))) TS_UpdateAddHTLC_free(uint64_t this_obj) {
30191         LDKUpdateAddHTLC this_obj_conv;
30192         this_obj_conv.inner = untag_ptr(this_obj);
30193         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30195         UpdateAddHTLC_free(this_obj_conv);
30196 }
30197
30198 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_get_channel_id"))) TS_UpdateAddHTLC_get_channel_id(uint64_t this_ptr) {
30199         LDKUpdateAddHTLC this_ptr_conv;
30200         this_ptr_conv.inner = untag_ptr(this_ptr);
30201         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30203         this_ptr_conv.is_owned = false;
30204         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30205         memcpy(ret_arr->elems, *UpdateAddHTLC_get_channel_id(&this_ptr_conv), 32);
30206         return ret_arr;
30207 }
30208
30209 void  __attribute__((export_name("TS_UpdateAddHTLC_set_channel_id"))) TS_UpdateAddHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
30210         LDKUpdateAddHTLC this_ptr_conv;
30211         this_ptr_conv.inner = untag_ptr(this_ptr);
30212         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30213         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30214         this_ptr_conv.is_owned = false;
30215         LDKThirtyTwoBytes val_ref;
30216         CHECK(val->arr_len == 32);
30217         memcpy(val_ref.data, val->elems, 32); FREE(val);
30218         UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
30219 }
30220
30221 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_htlc_id"))) TS_UpdateAddHTLC_get_htlc_id(uint64_t this_ptr) {
30222         LDKUpdateAddHTLC this_ptr_conv;
30223         this_ptr_conv.inner = untag_ptr(this_ptr);
30224         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30226         this_ptr_conv.is_owned = false;
30227         int64_t ret_conv = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
30228         return ret_conv;
30229 }
30230
30231 void  __attribute__((export_name("TS_UpdateAddHTLC_set_htlc_id"))) TS_UpdateAddHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
30232         LDKUpdateAddHTLC this_ptr_conv;
30233         this_ptr_conv.inner = untag_ptr(this_ptr);
30234         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30236         this_ptr_conv.is_owned = false;
30237         UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
30238 }
30239
30240 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_amount_msat"))) TS_UpdateAddHTLC_get_amount_msat(uint64_t this_ptr) {
30241         LDKUpdateAddHTLC this_ptr_conv;
30242         this_ptr_conv.inner = untag_ptr(this_ptr);
30243         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30245         this_ptr_conv.is_owned = false;
30246         int64_t ret_conv = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
30247         return ret_conv;
30248 }
30249
30250 void  __attribute__((export_name("TS_UpdateAddHTLC_set_amount_msat"))) TS_UpdateAddHTLC_set_amount_msat(uint64_t this_ptr, int64_t val) {
30251         LDKUpdateAddHTLC this_ptr_conv;
30252         this_ptr_conv.inner = untag_ptr(this_ptr);
30253         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30255         this_ptr_conv.is_owned = false;
30256         UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
30257 }
30258
30259 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_get_payment_hash"))) TS_UpdateAddHTLC_get_payment_hash(uint64_t this_ptr) {
30260         LDKUpdateAddHTLC this_ptr_conv;
30261         this_ptr_conv.inner = untag_ptr(this_ptr);
30262         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30264         this_ptr_conv.is_owned = false;
30265         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30266         memcpy(ret_arr->elems, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv), 32);
30267         return ret_arr;
30268 }
30269
30270 void  __attribute__((export_name("TS_UpdateAddHTLC_set_payment_hash"))) TS_UpdateAddHTLC_set_payment_hash(uint64_t this_ptr, int8_tArray val) {
30271         LDKUpdateAddHTLC this_ptr_conv;
30272         this_ptr_conv.inner = untag_ptr(this_ptr);
30273         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30275         this_ptr_conv.is_owned = false;
30276         LDKThirtyTwoBytes val_ref;
30277         CHECK(val->arr_len == 32);
30278         memcpy(val_ref.data, val->elems, 32); FREE(val);
30279         UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
30280 }
30281
30282 int32_t  __attribute__((export_name("TS_UpdateAddHTLC_get_cltv_expiry"))) TS_UpdateAddHTLC_get_cltv_expiry(uint64_t this_ptr) {
30283         LDKUpdateAddHTLC this_ptr_conv;
30284         this_ptr_conv.inner = untag_ptr(this_ptr);
30285         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30287         this_ptr_conv.is_owned = false;
30288         int32_t ret_conv = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
30289         return ret_conv;
30290 }
30291
30292 void  __attribute__((export_name("TS_UpdateAddHTLC_set_cltv_expiry"))) TS_UpdateAddHTLC_set_cltv_expiry(uint64_t this_ptr, int32_t val) {
30293         LDKUpdateAddHTLC this_ptr_conv;
30294         this_ptr_conv.inner = untag_ptr(this_ptr);
30295         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30297         this_ptr_conv.is_owned = false;
30298         UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
30299 }
30300
30301 static inline uint64_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
30302         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
30303         uint64_t ret_ref = 0;
30304         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30305         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30306         return ret_ref;
30307 }
30308 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_clone_ptr"))) TS_UpdateAddHTLC_clone_ptr(uint64_t arg) {
30309         LDKUpdateAddHTLC arg_conv;
30310         arg_conv.inner = untag_ptr(arg);
30311         arg_conv.is_owned = ptr_is_owned(arg);
30312         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30313         arg_conv.is_owned = false;
30314         int64_t ret_conv = UpdateAddHTLC_clone_ptr(&arg_conv);
30315         return ret_conv;
30316 }
30317
30318 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_clone"))) TS_UpdateAddHTLC_clone(uint64_t orig) {
30319         LDKUpdateAddHTLC orig_conv;
30320         orig_conv.inner = untag_ptr(orig);
30321         orig_conv.is_owned = ptr_is_owned(orig);
30322         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30323         orig_conv.is_owned = false;
30324         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
30325         uint64_t ret_ref = 0;
30326         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30327         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30328         return ret_ref;
30329 }
30330
30331 void  __attribute__((export_name("TS_OnionMessage_free"))) TS_OnionMessage_free(uint64_t this_obj) {
30332         LDKOnionMessage this_obj_conv;
30333         this_obj_conv.inner = untag_ptr(this_obj);
30334         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30336         OnionMessage_free(this_obj_conv);
30337 }
30338
30339 int8_tArray  __attribute__((export_name("TS_OnionMessage_get_blinding_point"))) TS_OnionMessage_get_blinding_point(uint64_t this_ptr) {
30340         LDKOnionMessage this_ptr_conv;
30341         this_ptr_conv.inner = untag_ptr(this_ptr);
30342         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30344         this_ptr_conv.is_owned = false;
30345         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30346         memcpy(ret_arr->elems, OnionMessage_get_blinding_point(&this_ptr_conv).compressed_form, 33);
30347         return ret_arr;
30348 }
30349
30350 void  __attribute__((export_name("TS_OnionMessage_set_blinding_point"))) TS_OnionMessage_set_blinding_point(uint64_t this_ptr, int8_tArray val) {
30351         LDKOnionMessage this_ptr_conv;
30352         this_ptr_conv.inner = untag_ptr(this_ptr);
30353         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30354         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30355         this_ptr_conv.is_owned = false;
30356         LDKPublicKey val_ref;
30357         CHECK(val->arr_len == 33);
30358         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30359         OnionMessage_set_blinding_point(&this_ptr_conv, val_ref);
30360 }
30361
30362 static inline uint64_t OnionMessage_clone_ptr(LDKOnionMessage *NONNULL_PTR arg) {
30363         LDKOnionMessage ret_var = OnionMessage_clone(arg);
30364         uint64_t ret_ref = 0;
30365         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30366         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30367         return ret_ref;
30368 }
30369 int64_t  __attribute__((export_name("TS_OnionMessage_clone_ptr"))) TS_OnionMessage_clone_ptr(uint64_t arg) {
30370         LDKOnionMessage arg_conv;
30371         arg_conv.inner = untag_ptr(arg);
30372         arg_conv.is_owned = ptr_is_owned(arg);
30373         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30374         arg_conv.is_owned = false;
30375         int64_t ret_conv = OnionMessage_clone_ptr(&arg_conv);
30376         return ret_conv;
30377 }
30378
30379 uint64_t  __attribute__((export_name("TS_OnionMessage_clone"))) TS_OnionMessage_clone(uint64_t orig) {
30380         LDKOnionMessage orig_conv;
30381         orig_conv.inner = untag_ptr(orig);
30382         orig_conv.is_owned = ptr_is_owned(orig);
30383         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30384         orig_conv.is_owned = false;
30385         LDKOnionMessage ret_var = OnionMessage_clone(&orig_conv);
30386         uint64_t ret_ref = 0;
30387         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30388         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30389         return ret_ref;
30390 }
30391
30392 void  __attribute__((export_name("TS_UpdateFulfillHTLC_free"))) TS_UpdateFulfillHTLC_free(uint64_t this_obj) {
30393         LDKUpdateFulfillHTLC this_obj_conv;
30394         this_obj_conv.inner = untag_ptr(this_obj);
30395         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30397         UpdateFulfillHTLC_free(this_obj_conv);
30398 }
30399
30400 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_get_channel_id"))) TS_UpdateFulfillHTLC_get_channel_id(uint64_t this_ptr) {
30401         LDKUpdateFulfillHTLC this_ptr_conv;
30402         this_ptr_conv.inner = untag_ptr(this_ptr);
30403         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30405         this_ptr_conv.is_owned = false;
30406         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30407         memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv), 32);
30408         return ret_arr;
30409 }
30410
30411 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_channel_id"))) TS_UpdateFulfillHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
30412         LDKUpdateFulfillHTLC this_ptr_conv;
30413         this_ptr_conv.inner = untag_ptr(this_ptr);
30414         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30416         this_ptr_conv.is_owned = false;
30417         LDKThirtyTwoBytes val_ref;
30418         CHECK(val->arr_len == 32);
30419         memcpy(val_ref.data, val->elems, 32); FREE(val);
30420         UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
30421 }
30422
30423 int64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_get_htlc_id"))) TS_UpdateFulfillHTLC_get_htlc_id(uint64_t this_ptr) {
30424         LDKUpdateFulfillHTLC this_ptr_conv;
30425         this_ptr_conv.inner = untag_ptr(this_ptr);
30426         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30428         this_ptr_conv.is_owned = false;
30429         int64_t ret_conv = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
30430         return ret_conv;
30431 }
30432
30433 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_htlc_id"))) TS_UpdateFulfillHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
30434         LDKUpdateFulfillHTLC this_ptr_conv;
30435         this_ptr_conv.inner = untag_ptr(this_ptr);
30436         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30438         this_ptr_conv.is_owned = false;
30439         UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
30440 }
30441
30442 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_get_payment_preimage"))) TS_UpdateFulfillHTLC_get_payment_preimage(uint64_t this_ptr) {
30443         LDKUpdateFulfillHTLC this_ptr_conv;
30444         this_ptr_conv.inner = untag_ptr(this_ptr);
30445         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30447         this_ptr_conv.is_owned = false;
30448         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30449         memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv), 32);
30450         return ret_arr;
30451 }
30452
30453 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_payment_preimage"))) TS_UpdateFulfillHTLC_set_payment_preimage(uint64_t this_ptr, int8_tArray val) {
30454         LDKUpdateFulfillHTLC this_ptr_conv;
30455         this_ptr_conv.inner = untag_ptr(this_ptr);
30456         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30458         this_ptr_conv.is_owned = false;
30459         LDKThirtyTwoBytes val_ref;
30460         CHECK(val->arr_len == 32);
30461         memcpy(val_ref.data, val->elems, 32); FREE(val);
30462         UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
30463 }
30464
30465 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) {
30466         LDKThirtyTwoBytes channel_id_arg_ref;
30467         CHECK(channel_id_arg->arr_len == 32);
30468         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
30469         LDKThirtyTwoBytes payment_preimage_arg_ref;
30470         CHECK(payment_preimage_arg->arr_len == 32);
30471         memcpy(payment_preimage_arg_ref.data, payment_preimage_arg->elems, 32); FREE(payment_preimage_arg);
30472         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
30473         uint64_t ret_ref = 0;
30474         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30475         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30476         return ret_ref;
30477 }
30478
30479 static inline uint64_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
30480         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
30481         uint64_t ret_ref = 0;
30482         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30483         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30484         return ret_ref;
30485 }
30486 int64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_clone_ptr"))) TS_UpdateFulfillHTLC_clone_ptr(uint64_t arg) {
30487         LDKUpdateFulfillHTLC arg_conv;
30488         arg_conv.inner = untag_ptr(arg);
30489         arg_conv.is_owned = ptr_is_owned(arg);
30490         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30491         arg_conv.is_owned = false;
30492         int64_t ret_conv = UpdateFulfillHTLC_clone_ptr(&arg_conv);
30493         return ret_conv;
30494 }
30495
30496 uint64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_clone"))) TS_UpdateFulfillHTLC_clone(uint64_t orig) {
30497         LDKUpdateFulfillHTLC orig_conv;
30498         orig_conv.inner = untag_ptr(orig);
30499         orig_conv.is_owned = ptr_is_owned(orig);
30500         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30501         orig_conv.is_owned = false;
30502         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
30503         uint64_t ret_ref = 0;
30504         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30505         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30506         return ret_ref;
30507 }
30508
30509 void  __attribute__((export_name("TS_UpdateFailHTLC_free"))) TS_UpdateFailHTLC_free(uint64_t this_obj) {
30510         LDKUpdateFailHTLC this_obj_conv;
30511         this_obj_conv.inner = untag_ptr(this_obj);
30512         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30514         UpdateFailHTLC_free(this_obj_conv);
30515 }
30516
30517 int8_tArray  __attribute__((export_name("TS_UpdateFailHTLC_get_channel_id"))) TS_UpdateFailHTLC_get_channel_id(uint64_t this_ptr) {
30518         LDKUpdateFailHTLC this_ptr_conv;
30519         this_ptr_conv.inner = untag_ptr(this_ptr);
30520         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30522         this_ptr_conv.is_owned = false;
30523         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30524         memcpy(ret_arr->elems, *UpdateFailHTLC_get_channel_id(&this_ptr_conv), 32);
30525         return ret_arr;
30526 }
30527
30528 void  __attribute__((export_name("TS_UpdateFailHTLC_set_channel_id"))) TS_UpdateFailHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
30529         LDKUpdateFailHTLC this_ptr_conv;
30530         this_ptr_conv.inner = untag_ptr(this_ptr);
30531         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30533         this_ptr_conv.is_owned = false;
30534         LDKThirtyTwoBytes val_ref;
30535         CHECK(val->arr_len == 32);
30536         memcpy(val_ref.data, val->elems, 32); FREE(val);
30537         UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
30538 }
30539
30540 int64_t  __attribute__((export_name("TS_UpdateFailHTLC_get_htlc_id"))) TS_UpdateFailHTLC_get_htlc_id(uint64_t this_ptr) {
30541         LDKUpdateFailHTLC this_ptr_conv;
30542         this_ptr_conv.inner = untag_ptr(this_ptr);
30543         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30545         this_ptr_conv.is_owned = false;
30546         int64_t ret_conv = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
30547         return ret_conv;
30548 }
30549
30550 void  __attribute__((export_name("TS_UpdateFailHTLC_set_htlc_id"))) TS_UpdateFailHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
30551         LDKUpdateFailHTLC this_ptr_conv;
30552         this_ptr_conv.inner = untag_ptr(this_ptr);
30553         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30555         this_ptr_conv.is_owned = false;
30556         UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
30557 }
30558
30559 static inline uint64_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
30560         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
30561         uint64_t ret_ref = 0;
30562         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30563         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30564         return ret_ref;
30565 }
30566 int64_t  __attribute__((export_name("TS_UpdateFailHTLC_clone_ptr"))) TS_UpdateFailHTLC_clone_ptr(uint64_t arg) {
30567         LDKUpdateFailHTLC arg_conv;
30568         arg_conv.inner = untag_ptr(arg);
30569         arg_conv.is_owned = ptr_is_owned(arg);
30570         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30571         arg_conv.is_owned = false;
30572         int64_t ret_conv = UpdateFailHTLC_clone_ptr(&arg_conv);
30573         return ret_conv;
30574 }
30575
30576 uint64_t  __attribute__((export_name("TS_UpdateFailHTLC_clone"))) TS_UpdateFailHTLC_clone(uint64_t orig) {
30577         LDKUpdateFailHTLC orig_conv;
30578         orig_conv.inner = untag_ptr(orig);
30579         orig_conv.is_owned = ptr_is_owned(orig);
30580         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30581         orig_conv.is_owned = false;
30582         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
30583         uint64_t ret_ref = 0;
30584         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30585         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30586         return ret_ref;
30587 }
30588
30589 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_free"))) TS_UpdateFailMalformedHTLC_free(uint64_t this_obj) {
30590         LDKUpdateFailMalformedHTLC this_obj_conv;
30591         this_obj_conv.inner = untag_ptr(this_obj);
30592         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30594         UpdateFailMalformedHTLC_free(this_obj_conv);
30595 }
30596
30597 int8_tArray  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_channel_id"))) TS_UpdateFailMalformedHTLC_get_channel_id(uint64_t this_ptr) {
30598         LDKUpdateFailMalformedHTLC this_ptr_conv;
30599         this_ptr_conv.inner = untag_ptr(this_ptr);
30600         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30602         this_ptr_conv.is_owned = false;
30603         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30604         memcpy(ret_arr->elems, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv), 32);
30605         return ret_arr;
30606 }
30607
30608 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_channel_id"))) TS_UpdateFailMalformedHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
30609         LDKUpdateFailMalformedHTLC this_ptr_conv;
30610         this_ptr_conv.inner = untag_ptr(this_ptr);
30611         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30613         this_ptr_conv.is_owned = false;
30614         LDKThirtyTwoBytes val_ref;
30615         CHECK(val->arr_len == 32);
30616         memcpy(val_ref.data, val->elems, 32); FREE(val);
30617         UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
30618 }
30619
30620 int64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_htlc_id"))) TS_UpdateFailMalformedHTLC_get_htlc_id(uint64_t this_ptr) {
30621         LDKUpdateFailMalformedHTLC this_ptr_conv;
30622         this_ptr_conv.inner = untag_ptr(this_ptr);
30623         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30625         this_ptr_conv.is_owned = false;
30626         int64_t ret_conv = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
30627         return ret_conv;
30628 }
30629
30630 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_htlc_id"))) TS_UpdateFailMalformedHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
30631         LDKUpdateFailMalformedHTLC this_ptr_conv;
30632         this_ptr_conv.inner = untag_ptr(this_ptr);
30633         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30635         this_ptr_conv.is_owned = false;
30636         UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
30637 }
30638
30639 int16_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_failure_code"))) TS_UpdateFailMalformedHTLC_get_failure_code(uint64_t this_ptr) {
30640         LDKUpdateFailMalformedHTLC this_ptr_conv;
30641         this_ptr_conv.inner = untag_ptr(this_ptr);
30642         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30644         this_ptr_conv.is_owned = false;
30645         int16_t ret_conv = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
30646         return ret_conv;
30647 }
30648
30649 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_failure_code"))) TS_UpdateFailMalformedHTLC_set_failure_code(uint64_t this_ptr, int16_t val) {
30650         LDKUpdateFailMalformedHTLC this_ptr_conv;
30651         this_ptr_conv.inner = untag_ptr(this_ptr);
30652         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30654         this_ptr_conv.is_owned = false;
30655         UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
30656 }
30657
30658 static inline uint64_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
30659         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
30660         uint64_t ret_ref = 0;
30661         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30662         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30663         return ret_ref;
30664 }
30665 int64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone_ptr"))) TS_UpdateFailMalformedHTLC_clone_ptr(uint64_t arg) {
30666         LDKUpdateFailMalformedHTLC arg_conv;
30667         arg_conv.inner = untag_ptr(arg);
30668         arg_conv.is_owned = ptr_is_owned(arg);
30669         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30670         arg_conv.is_owned = false;
30671         int64_t ret_conv = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
30672         return ret_conv;
30673 }
30674
30675 uint64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone"))) TS_UpdateFailMalformedHTLC_clone(uint64_t orig) {
30676         LDKUpdateFailMalformedHTLC orig_conv;
30677         orig_conv.inner = untag_ptr(orig);
30678         orig_conv.is_owned = ptr_is_owned(orig);
30679         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30680         orig_conv.is_owned = false;
30681         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
30682         uint64_t ret_ref = 0;
30683         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30684         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30685         return ret_ref;
30686 }
30687
30688 void  __attribute__((export_name("TS_CommitmentSigned_free"))) TS_CommitmentSigned_free(uint64_t this_obj) {
30689         LDKCommitmentSigned this_obj_conv;
30690         this_obj_conv.inner = untag_ptr(this_obj);
30691         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30693         CommitmentSigned_free(this_obj_conv);
30694 }
30695
30696 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_get_channel_id"))) TS_CommitmentSigned_get_channel_id(uint64_t this_ptr) {
30697         LDKCommitmentSigned this_ptr_conv;
30698         this_ptr_conv.inner = untag_ptr(this_ptr);
30699         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30701         this_ptr_conv.is_owned = false;
30702         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30703         memcpy(ret_arr->elems, *CommitmentSigned_get_channel_id(&this_ptr_conv), 32);
30704         return ret_arr;
30705 }
30706
30707 void  __attribute__((export_name("TS_CommitmentSigned_set_channel_id"))) TS_CommitmentSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
30708         LDKCommitmentSigned this_ptr_conv;
30709         this_ptr_conv.inner = untag_ptr(this_ptr);
30710         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30712         this_ptr_conv.is_owned = false;
30713         LDKThirtyTwoBytes val_ref;
30714         CHECK(val->arr_len == 32);
30715         memcpy(val_ref.data, val->elems, 32); FREE(val);
30716         CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
30717 }
30718
30719 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_get_signature"))) TS_CommitmentSigned_get_signature(uint64_t this_ptr) {
30720         LDKCommitmentSigned this_ptr_conv;
30721         this_ptr_conv.inner = untag_ptr(this_ptr);
30722         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30724         this_ptr_conv.is_owned = false;
30725         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
30726         memcpy(ret_arr->elems, CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64);
30727         return ret_arr;
30728 }
30729
30730 void  __attribute__((export_name("TS_CommitmentSigned_set_signature"))) TS_CommitmentSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
30731         LDKCommitmentSigned this_ptr_conv;
30732         this_ptr_conv.inner = untag_ptr(this_ptr);
30733         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30735         this_ptr_conv.is_owned = false;
30736         LDKSignature val_ref;
30737         CHECK(val->arr_len == 64);
30738         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
30739         CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
30740 }
30741
30742 ptrArray  __attribute__((export_name("TS_CommitmentSigned_get_htlc_signatures"))) TS_CommitmentSigned_get_htlc_signatures(uint64_t this_ptr) {
30743         LDKCommitmentSigned this_ptr_conv;
30744         this_ptr_conv.inner = untag_ptr(this_ptr);
30745         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30747         this_ptr_conv.is_owned = false;
30748         LDKCVec_SignatureZ ret_var = CommitmentSigned_get_htlc_signatures(&this_ptr_conv);
30749         ptrArray ret_arr = NULL;
30750         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
30751         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
30752         for (size_t m = 0; m < ret_var.datalen; m++) {
30753                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
30754                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
30755                 ret_arr_ptr[m] = ret_conv_12_arr;
30756         }
30757         
30758         FREE(ret_var.data);
30759         return ret_arr;
30760 }
30761
30762 void  __attribute__((export_name("TS_CommitmentSigned_set_htlc_signatures"))) TS_CommitmentSigned_set_htlc_signatures(uint64_t this_ptr, ptrArray val) {
30763         LDKCommitmentSigned this_ptr_conv;
30764         this_ptr_conv.inner = untag_ptr(this_ptr);
30765         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30766         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30767         this_ptr_conv.is_owned = false;
30768         LDKCVec_SignatureZ val_constr;
30769         val_constr.datalen = val->arr_len;
30770         if (val_constr.datalen > 0)
30771                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
30772         else
30773                 val_constr.data = NULL;
30774         int8_tArray* val_vals = (void*) val->elems;
30775         for (size_t m = 0; m < val_constr.datalen; m++) {
30776                 int8_tArray val_conv_12 = val_vals[m];
30777                 LDKSignature val_conv_12_ref;
30778                 CHECK(val_conv_12->arr_len == 64);
30779                 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64); FREE(val_conv_12);
30780                 val_constr.data[m] = val_conv_12_ref;
30781         }
30782         FREE(val);
30783         CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
30784 }
30785
30786 uint64_t  __attribute__((export_name("TS_CommitmentSigned_new"))) TS_CommitmentSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg, ptrArray htlc_signatures_arg) {
30787         LDKThirtyTwoBytes channel_id_arg_ref;
30788         CHECK(channel_id_arg->arr_len == 32);
30789         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
30790         LDKSignature signature_arg_ref;
30791         CHECK(signature_arg->arr_len == 64);
30792         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
30793         LDKCVec_SignatureZ htlc_signatures_arg_constr;
30794         htlc_signatures_arg_constr.datalen = htlc_signatures_arg->arr_len;
30795         if (htlc_signatures_arg_constr.datalen > 0)
30796                 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
30797         else
30798                 htlc_signatures_arg_constr.data = NULL;
30799         int8_tArray* htlc_signatures_arg_vals = (void*) htlc_signatures_arg->elems;
30800         for (size_t m = 0; m < htlc_signatures_arg_constr.datalen; m++) {
30801                 int8_tArray htlc_signatures_arg_conv_12 = htlc_signatures_arg_vals[m];
30802                 LDKSignature htlc_signatures_arg_conv_12_ref;
30803                 CHECK(htlc_signatures_arg_conv_12->arr_len == 64);
30804                 memcpy(htlc_signatures_arg_conv_12_ref.compact_form, htlc_signatures_arg_conv_12->elems, 64); FREE(htlc_signatures_arg_conv_12);
30805                 htlc_signatures_arg_constr.data[m] = htlc_signatures_arg_conv_12_ref;
30806         }
30807         FREE(htlc_signatures_arg);
30808         LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
30809         uint64_t ret_ref = 0;
30810         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30811         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30812         return ret_ref;
30813 }
30814
30815 static inline uint64_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
30816         LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
30817         uint64_t ret_ref = 0;
30818         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30819         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30820         return ret_ref;
30821 }
30822 int64_t  __attribute__((export_name("TS_CommitmentSigned_clone_ptr"))) TS_CommitmentSigned_clone_ptr(uint64_t arg) {
30823         LDKCommitmentSigned arg_conv;
30824         arg_conv.inner = untag_ptr(arg);
30825         arg_conv.is_owned = ptr_is_owned(arg);
30826         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30827         arg_conv.is_owned = false;
30828         int64_t ret_conv = CommitmentSigned_clone_ptr(&arg_conv);
30829         return ret_conv;
30830 }
30831
30832 uint64_t  __attribute__((export_name("TS_CommitmentSigned_clone"))) TS_CommitmentSigned_clone(uint64_t orig) {
30833         LDKCommitmentSigned orig_conv;
30834         orig_conv.inner = untag_ptr(orig);
30835         orig_conv.is_owned = ptr_is_owned(orig);
30836         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30837         orig_conv.is_owned = false;
30838         LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
30839         uint64_t ret_ref = 0;
30840         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30841         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30842         return ret_ref;
30843 }
30844
30845 void  __attribute__((export_name("TS_RevokeAndACK_free"))) TS_RevokeAndACK_free(uint64_t this_obj) {
30846         LDKRevokeAndACK this_obj_conv;
30847         this_obj_conv.inner = untag_ptr(this_obj);
30848         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30850         RevokeAndACK_free(this_obj_conv);
30851 }
30852
30853 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_channel_id"))) TS_RevokeAndACK_get_channel_id(uint64_t this_ptr) {
30854         LDKRevokeAndACK this_ptr_conv;
30855         this_ptr_conv.inner = untag_ptr(this_ptr);
30856         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30858         this_ptr_conv.is_owned = false;
30859         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30860         memcpy(ret_arr->elems, *RevokeAndACK_get_channel_id(&this_ptr_conv), 32);
30861         return ret_arr;
30862 }
30863
30864 void  __attribute__((export_name("TS_RevokeAndACK_set_channel_id"))) TS_RevokeAndACK_set_channel_id(uint64_t this_ptr, int8_tArray val) {
30865         LDKRevokeAndACK this_ptr_conv;
30866         this_ptr_conv.inner = untag_ptr(this_ptr);
30867         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30869         this_ptr_conv.is_owned = false;
30870         LDKThirtyTwoBytes val_ref;
30871         CHECK(val->arr_len == 32);
30872         memcpy(val_ref.data, val->elems, 32); FREE(val);
30873         RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
30874 }
30875
30876 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_per_commitment_secret"))) TS_RevokeAndACK_get_per_commitment_secret(uint64_t this_ptr) {
30877         LDKRevokeAndACK this_ptr_conv;
30878         this_ptr_conv.inner = untag_ptr(this_ptr);
30879         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30880         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30881         this_ptr_conv.is_owned = false;
30882         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30883         memcpy(ret_arr->elems, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv), 32);
30884         return ret_arr;
30885 }
30886
30887 void  __attribute__((export_name("TS_RevokeAndACK_set_per_commitment_secret"))) TS_RevokeAndACK_set_per_commitment_secret(uint64_t this_ptr, int8_tArray val) {
30888         LDKRevokeAndACK this_ptr_conv;
30889         this_ptr_conv.inner = untag_ptr(this_ptr);
30890         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30892         this_ptr_conv.is_owned = false;
30893         LDKThirtyTwoBytes val_ref;
30894         CHECK(val->arr_len == 32);
30895         memcpy(val_ref.data, val->elems, 32); FREE(val);
30896         RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
30897 }
30898
30899 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_next_per_commitment_point"))) TS_RevokeAndACK_get_next_per_commitment_point(uint64_t this_ptr) {
30900         LDKRevokeAndACK this_ptr_conv;
30901         this_ptr_conv.inner = untag_ptr(this_ptr);
30902         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30904         this_ptr_conv.is_owned = false;
30905         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30906         memcpy(ret_arr->elems, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
30907         return ret_arr;
30908 }
30909
30910 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) {
30911         LDKRevokeAndACK this_ptr_conv;
30912         this_ptr_conv.inner = untag_ptr(this_ptr);
30913         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30915         this_ptr_conv.is_owned = false;
30916         LDKPublicKey val_ref;
30917         CHECK(val->arr_len == 33);
30918         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30919         RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
30920 }
30921
30922 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) {
30923         LDKThirtyTwoBytes channel_id_arg_ref;
30924         CHECK(channel_id_arg->arr_len == 32);
30925         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
30926         LDKThirtyTwoBytes per_commitment_secret_arg_ref;
30927         CHECK(per_commitment_secret_arg->arr_len == 32);
30928         memcpy(per_commitment_secret_arg_ref.data, per_commitment_secret_arg->elems, 32); FREE(per_commitment_secret_arg);
30929         LDKPublicKey next_per_commitment_point_arg_ref;
30930         CHECK(next_per_commitment_point_arg->arr_len == 33);
30931         memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
30932         LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
30933         uint64_t ret_ref = 0;
30934         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30935         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30936         return ret_ref;
30937 }
30938
30939 static inline uint64_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
30940         LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
30941         uint64_t ret_ref = 0;
30942         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30943         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30944         return ret_ref;
30945 }
30946 int64_t  __attribute__((export_name("TS_RevokeAndACK_clone_ptr"))) TS_RevokeAndACK_clone_ptr(uint64_t arg) {
30947         LDKRevokeAndACK arg_conv;
30948         arg_conv.inner = untag_ptr(arg);
30949         arg_conv.is_owned = ptr_is_owned(arg);
30950         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30951         arg_conv.is_owned = false;
30952         int64_t ret_conv = RevokeAndACK_clone_ptr(&arg_conv);
30953         return ret_conv;
30954 }
30955
30956 uint64_t  __attribute__((export_name("TS_RevokeAndACK_clone"))) TS_RevokeAndACK_clone(uint64_t orig) {
30957         LDKRevokeAndACK orig_conv;
30958         orig_conv.inner = untag_ptr(orig);
30959         orig_conv.is_owned = ptr_is_owned(orig);
30960         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30961         orig_conv.is_owned = false;
30962         LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
30963         uint64_t ret_ref = 0;
30964         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30965         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30966         return ret_ref;
30967 }
30968
30969 void  __attribute__((export_name("TS_UpdateFee_free"))) TS_UpdateFee_free(uint64_t this_obj) {
30970         LDKUpdateFee this_obj_conv;
30971         this_obj_conv.inner = untag_ptr(this_obj);
30972         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30974         UpdateFee_free(this_obj_conv);
30975 }
30976
30977 int8_tArray  __attribute__((export_name("TS_UpdateFee_get_channel_id"))) TS_UpdateFee_get_channel_id(uint64_t this_ptr) {
30978         LDKUpdateFee this_ptr_conv;
30979         this_ptr_conv.inner = untag_ptr(this_ptr);
30980         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30982         this_ptr_conv.is_owned = false;
30983         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30984         memcpy(ret_arr->elems, *UpdateFee_get_channel_id(&this_ptr_conv), 32);
30985         return ret_arr;
30986 }
30987
30988 void  __attribute__((export_name("TS_UpdateFee_set_channel_id"))) TS_UpdateFee_set_channel_id(uint64_t this_ptr, int8_tArray val) {
30989         LDKUpdateFee this_ptr_conv;
30990         this_ptr_conv.inner = untag_ptr(this_ptr);
30991         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30993         this_ptr_conv.is_owned = false;
30994         LDKThirtyTwoBytes val_ref;
30995         CHECK(val->arr_len == 32);
30996         memcpy(val_ref.data, val->elems, 32); FREE(val);
30997         UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
30998 }
30999
31000 int32_t  __attribute__((export_name("TS_UpdateFee_get_feerate_per_kw"))) TS_UpdateFee_get_feerate_per_kw(uint64_t this_ptr) {
31001         LDKUpdateFee this_ptr_conv;
31002         this_ptr_conv.inner = untag_ptr(this_ptr);
31003         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31005         this_ptr_conv.is_owned = false;
31006         int32_t ret_conv = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
31007         return ret_conv;
31008 }
31009
31010 void  __attribute__((export_name("TS_UpdateFee_set_feerate_per_kw"))) TS_UpdateFee_set_feerate_per_kw(uint64_t this_ptr, int32_t val) {
31011         LDKUpdateFee this_ptr_conv;
31012         this_ptr_conv.inner = untag_ptr(this_ptr);
31013         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31014         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31015         this_ptr_conv.is_owned = false;
31016         UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
31017 }
31018
31019 uint64_t  __attribute__((export_name("TS_UpdateFee_new"))) TS_UpdateFee_new(int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
31020         LDKThirtyTwoBytes channel_id_arg_ref;
31021         CHECK(channel_id_arg->arr_len == 32);
31022         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
31023         LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
31024         uint64_t ret_ref = 0;
31025         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31026         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31027         return ret_ref;
31028 }
31029
31030 static inline uint64_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
31031         LDKUpdateFee ret_var = UpdateFee_clone(arg);
31032         uint64_t ret_ref = 0;
31033         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31034         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31035         return ret_ref;
31036 }
31037 int64_t  __attribute__((export_name("TS_UpdateFee_clone_ptr"))) TS_UpdateFee_clone_ptr(uint64_t arg) {
31038         LDKUpdateFee arg_conv;
31039         arg_conv.inner = untag_ptr(arg);
31040         arg_conv.is_owned = ptr_is_owned(arg);
31041         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31042         arg_conv.is_owned = false;
31043         int64_t ret_conv = UpdateFee_clone_ptr(&arg_conv);
31044         return ret_conv;
31045 }
31046
31047 uint64_t  __attribute__((export_name("TS_UpdateFee_clone"))) TS_UpdateFee_clone(uint64_t orig) {
31048         LDKUpdateFee orig_conv;
31049         orig_conv.inner = untag_ptr(orig);
31050         orig_conv.is_owned = ptr_is_owned(orig);
31051         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31052         orig_conv.is_owned = false;
31053         LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
31054         uint64_t ret_ref = 0;
31055         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31056         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31057         return ret_ref;
31058 }
31059
31060 void  __attribute__((export_name("TS_DataLossProtect_free"))) TS_DataLossProtect_free(uint64_t this_obj) {
31061         LDKDataLossProtect this_obj_conv;
31062         this_obj_conv.inner = untag_ptr(this_obj);
31063         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31065         DataLossProtect_free(this_obj_conv);
31066 }
31067
31068 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) {
31069         LDKDataLossProtect this_ptr_conv;
31070         this_ptr_conv.inner = untag_ptr(this_ptr);
31071         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31073         this_ptr_conv.is_owned = false;
31074         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31075         memcpy(ret_arr->elems, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv), 32);
31076         return ret_arr;
31077 }
31078
31079 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) {
31080         LDKDataLossProtect this_ptr_conv;
31081         this_ptr_conv.inner = untag_ptr(this_ptr);
31082         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31084         this_ptr_conv.is_owned = false;
31085         LDKThirtyTwoBytes val_ref;
31086         CHECK(val->arr_len == 32);
31087         memcpy(val_ref.data, val->elems, 32); FREE(val);
31088         DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
31089 }
31090
31091 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) {
31092         LDKDataLossProtect this_ptr_conv;
31093         this_ptr_conv.inner = untag_ptr(this_ptr);
31094         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31096         this_ptr_conv.is_owned = false;
31097         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31098         memcpy(ret_arr->elems, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33);
31099         return ret_arr;
31100 }
31101
31102 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) {
31103         LDKDataLossProtect this_ptr_conv;
31104         this_ptr_conv.inner = untag_ptr(this_ptr);
31105         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31107         this_ptr_conv.is_owned = false;
31108         LDKPublicKey val_ref;
31109         CHECK(val->arr_len == 33);
31110         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31111         DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
31112 }
31113
31114 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) {
31115         LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
31116         CHECK(your_last_per_commitment_secret_arg->arr_len == 32);
31117         memcpy(your_last_per_commitment_secret_arg_ref.data, your_last_per_commitment_secret_arg->elems, 32); FREE(your_last_per_commitment_secret_arg);
31118         LDKPublicKey my_current_per_commitment_point_arg_ref;
31119         CHECK(my_current_per_commitment_point_arg->arr_len == 33);
31120         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);
31121         LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
31122         uint64_t ret_ref = 0;
31123         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31124         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31125         return ret_ref;
31126 }
31127
31128 static inline uint64_t DataLossProtect_clone_ptr(LDKDataLossProtect *NONNULL_PTR arg) {
31129         LDKDataLossProtect ret_var = DataLossProtect_clone(arg);
31130         uint64_t ret_ref = 0;
31131         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31132         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31133         return ret_ref;
31134 }
31135 int64_t  __attribute__((export_name("TS_DataLossProtect_clone_ptr"))) TS_DataLossProtect_clone_ptr(uint64_t arg) {
31136         LDKDataLossProtect arg_conv;
31137         arg_conv.inner = untag_ptr(arg);
31138         arg_conv.is_owned = ptr_is_owned(arg);
31139         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31140         arg_conv.is_owned = false;
31141         int64_t ret_conv = DataLossProtect_clone_ptr(&arg_conv);
31142         return ret_conv;
31143 }
31144
31145 uint64_t  __attribute__((export_name("TS_DataLossProtect_clone"))) TS_DataLossProtect_clone(uint64_t orig) {
31146         LDKDataLossProtect orig_conv;
31147         orig_conv.inner = untag_ptr(orig);
31148         orig_conv.is_owned = ptr_is_owned(orig);
31149         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31150         orig_conv.is_owned = false;
31151         LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
31152         uint64_t ret_ref = 0;
31153         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31154         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31155         return ret_ref;
31156 }
31157
31158 void  __attribute__((export_name("TS_ChannelReestablish_free"))) TS_ChannelReestablish_free(uint64_t this_obj) {
31159         LDKChannelReestablish this_obj_conv;
31160         this_obj_conv.inner = untag_ptr(this_obj);
31161         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31162         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31163         ChannelReestablish_free(this_obj_conv);
31164 }
31165
31166 int8_tArray  __attribute__((export_name("TS_ChannelReestablish_get_channel_id"))) TS_ChannelReestablish_get_channel_id(uint64_t this_ptr) {
31167         LDKChannelReestablish this_ptr_conv;
31168         this_ptr_conv.inner = untag_ptr(this_ptr);
31169         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31171         this_ptr_conv.is_owned = false;
31172         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31173         memcpy(ret_arr->elems, *ChannelReestablish_get_channel_id(&this_ptr_conv), 32);
31174         return ret_arr;
31175 }
31176
31177 void  __attribute__((export_name("TS_ChannelReestablish_set_channel_id"))) TS_ChannelReestablish_set_channel_id(uint64_t this_ptr, int8_tArray val) {
31178         LDKChannelReestablish this_ptr_conv;
31179         this_ptr_conv.inner = untag_ptr(this_ptr);
31180         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31182         this_ptr_conv.is_owned = false;
31183         LDKThirtyTwoBytes val_ref;
31184         CHECK(val->arr_len == 32);
31185         memcpy(val_ref.data, val->elems, 32); FREE(val);
31186         ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
31187 }
31188
31189 int64_t  __attribute__((export_name("TS_ChannelReestablish_get_next_local_commitment_number"))) TS_ChannelReestablish_get_next_local_commitment_number(uint64_t this_ptr) {
31190         LDKChannelReestablish this_ptr_conv;
31191         this_ptr_conv.inner = untag_ptr(this_ptr);
31192         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31194         this_ptr_conv.is_owned = false;
31195         int64_t ret_conv = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
31196         return ret_conv;
31197 }
31198
31199 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) {
31200         LDKChannelReestablish this_ptr_conv;
31201         this_ptr_conv.inner = untag_ptr(this_ptr);
31202         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31204         this_ptr_conv.is_owned = false;
31205         ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
31206 }
31207
31208 int64_t  __attribute__((export_name("TS_ChannelReestablish_get_next_remote_commitment_number"))) TS_ChannelReestablish_get_next_remote_commitment_number(uint64_t this_ptr) {
31209         LDKChannelReestablish this_ptr_conv;
31210         this_ptr_conv.inner = untag_ptr(this_ptr);
31211         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31213         this_ptr_conv.is_owned = false;
31214         int64_t ret_conv = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
31215         return ret_conv;
31216 }
31217
31218 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) {
31219         LDKChannelReestablish this_ptr_conv;
31220         this_ptr_conv.inner = untag_ptr(this_ptr);
31221         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31223         this_ptr_conv.is_owned = false;
31224         ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
31225 }
31226
31227 static inline uint64_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
31228         LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
31229         uint64_t ret_ref = 0;
31230         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31231         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31232         return ret_ref;
31233 }
31234 int64_t  __attribute__((export_name("TS_ChannelReestablish_clone_ptr"))) TS_ChannelReestablish_clone_ptr(uint64_t arg) {
31235         LDKChannelReestablish arg_conv;
31236         arg_conv.inner = untag_ptr(arg);
31237         arg_conv.is_owned = ptr_is_owned(arg);
31238         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31239         arg_conv.is_owned = false;
31240         int64_t ret_conv = ChannelReestablish_clone_ptr(&arg_conv);
31241         return ret_conv;
31242 }
31243
31244 uint64_t  __attribute__((export_name("TS_ChannelReestablish_clone"))) TS_ChannelReestablish_clone(uint64_t orig) {
31245         LDKChannelReestablish orig_conv;
31246         orig_conv.inner = untag_ptr(orig);
31247         orig_conv.is_owned = ptr_is_owned(orig);
31248         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31249         orig_conv.is_owned = false;
31250         LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
31251         uint64_t ret_ref = 0;
31252         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31253         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31254         return ret_ref;
31255 }
31256
31257 void  __attribute__((export_name("TS_AnnouncementSignatures_free"))) TS_AnnouncementSignatures_free(uint64_t this_obj) {
31258         LDKAnnouncementSignatures this_obj_conv;
31259         this_obj_conv.inner = untag_ptr(this_obj);
31260         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31262         AnnouncementSignatures_free(this_obj_conv);
31263 }
31264
31265 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_channel_id"))) TS_AnnouncementSignatures_get_channel_id(uint64_t this_ptr) {
31266         LDKAnnouncementSignatures this_ptr_conv;
31267         this_ptr_conv.inner = untag_ptr(this_ptr);
31268         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31270         this_ptr_conv.is_owned = false;
31271         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31272         memcpy(ret_arr->elems, *AnnouncementSignatures_get_channel_id(&this_ptr_conv), 32);
31273         return ret_arr;
31274 }
31275
31276 void  __attribute__((export_name("TS_AnnouncementSignatures_set_channel_id"))) TS_AnnouncementSignatures_set_channel_id(uint64_t this_ptr, int8_tArray val) {
31277         LDKAnnouncementSignatures this_ptr_conv;
31278         this_ptr_conv.inner = untag_ptr(this_ptr);
31279         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31281         this_ptr_conv.is_owned = false;
31282         LDKThirtyTwoBytes val_ref;
31283         CHECK(val->arr_len == 32);
31284         memcpy(val_ref.data, val->elems, 32); FREE(val);
31285         AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
31286 }
31287
31288 int64_t  __attribute__((export_name("TS_AnnouncementSignatures_get_short_channel_id"))) TS_AnnouncementSignatures_get_short_channel_id(uint64_t this_ptr) {
31289         LDKAnnouncementSignatures this_ptr_conv;
31290         this_ptr_conv.inner = untag_ptr(this_ptr);
31291         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31293         this_ptr_conv.is_owned = false;
31294         int64_t ret_conv = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
31295         return ret_conv;
31296 }
31297
31298 void  __attribute__((export_name("TS_AnnouncementSignatures_set_short_channel_id"))) TS_AnnouncementSignatures_set_short_channel_id(uint64_t this_ptr, int64_t val) {
31299         LDKAnnouncementSignatures this_ptr_conv;
31300         this_ptr_conv.inner = untag_ptr(this_ptr);
31301         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31303         this_ptr_conv.is_owned = false;
31304         AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
31305 }
31306
31307 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_node_signature"))) TS_AnnouncementSignatures_get_node_signature(uint64_t this_ptr) {
31308         LDKAnnouncementSignatures this_ptr_conv;
31309         this_ptr_conv.inner = untag_ptr(this_ptr);
31310         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31312         this_ptr_conv.is_owned = false;
31313         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
31314         memcpy(ret_arr->elems, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64);
31315         return ret_arr;
31316 }
31317
31318 void  __attribute__((export_name("TS_AnnouncementSignatures_set_node_signature"))) TS_AnnouncementSignatures_set_node_signature(uint64_t this_ptr, int8_tArray val) {
31319         LDKAnnouncementSignatures this_ptr_conv;
31320         this_ptr_conv.inner = untag_ptr(this_ptr);
31321         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31323         this_ptr_conv.is_owned = false;
31324         LDKSignature val_ref;
31325         CHECK(val->arr_len == 64);
31326         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
31327         AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
31328 }
31329
31330 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_bitcoin_signature"))) TS_AnnouncementSignatures_get_bitcoin_signature(uint64_t this_ptr) {
31331         LDKAnnouncementSignatures this_ptr_conv;
31332         this_ptr_conv.inner = untag_ptr(this_ptr);
31333         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31335         this_ptr_conv.is_owned = false;
31336         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
31337         memcpy(ret_arr->elems, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64);
31338         return ret_arr;
31339 }
31340
31341 void  __attribute__((export_name("TS_AnnouncementSignatures_set_bitcoin_signature"))) TS_AnnouncementSignatures_set_bitcoin_signature(uint64_t this_ptr, int8_tArray val) {
31342         LDKAnnouncementSignatures this_ptr_conv;
31343         this_ptr_conv.inner = untag_ptr(this_ptr);
31344         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31346         this_ptr_conv.is_owned = false;
31347         LDKSignature val_ref;
31348         CHECK(val->arr_len == 64);
31349         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
31350         AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
31351 }
31352
31353 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) {
31354         LDKThirtyTwoBytes channel_id_arg_ref;
31355         CHECK(channel_id_arg->arr_len == 32);
31356         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
31357         LDKSignature node_signature_arg_ref;
31358         CHECK(node_signature_arg->arr_len == 64);
31359         memcpy(node_signature_arg_ref.compact_form, node_signature_arg->elems, 64); FREE(node_signature_arg);
31360         LDKSignature bitcoin_signature_arg_ref;
31361         CHECK(bitcoin_signature_arg->arr_len == 64);
31362         memcpy(bitcoin_signature_arg_ref.compact_form, bitcoin_signature_arg->elems, 64); FREE(bitcoin_signature_arg);
31363         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
31364         uint64_t ret_ref = 0;
31365         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31366         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31367         return ret_ref;
31368 }
31369
31370 static inline uint64_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
31371         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
31372         uint64_t ret_ref = 0;
31373         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31374         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31375         return ret_ref;
31376 }
31377 int64_t  __attribute__((export_name("TS_AnnouncementSignatures_clone_ptr"))) TS_AnnouncementSignatures_clone_ptr(uint64_t arg) {
31378         LDKAnnouncementSignatures arg_conv;
31379         arg_conv.inner = untag_ptr(arg);
31380         arg_conv.is_owned = ptr_is_owned(arg);
31381         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31382         arg_conv.is_owned = false;
31383         int64_t ret_conv = AnnouncementSignatures_clone_ptr(&arg_conv);
31384         return ret_conv;
31385 }
31386
31387 uint64_t  __attribute__((export_name("TS_AnnouncementSignatures_clone"))) TS_AnnouncementSignatures_clone(uint64_t orig) {
31388         LDKAnnouncementSignatures orig_conv;
31389         orig_conv.inner = untag_ptr(orig);
31390         orig_conv.is_owned = ptr_is_owned(orig);
31391         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31392         orig_conv.is_owned = false;
31393         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
31394         uint64_t ret_ref = 0;
31395         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31396         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31397         return ret_ref;
31398 }
31399
31400 void  __attribute__((export_name("TS_NetAddress_free"))) TS_NetAddress_free(uint64_t this_ptr) {
31401         if (!ptr_is_owned(this_ptr)) return;
31402         void* this_ptr_ptr = untag_ptr(this_ptr);
31403         CHECK_ACCESS(this_ptr_ptr);
31404         LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(this_ptr_ptr);
31405         FREE(untag_ptr(this_ptr));
31406         NetAddress_free(this_ptr_conv);
31407 }
31408
31409 static inline uint64_t NetAddress_clone_ptr(LDKNetAddress *NONNULL_PTR arg) {
31410         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
31411         *ret_copy = NetAddress_clone(arg);
31412         uint64_t ret_ref = tag_ptr(ret_copy, true);
31413         return ret_ref;
31414 }
31415 int64_t  __attribute__((export_name("TS_NetAddress_clone_ptr"))) TS_NetAddress_clone_ptr(uint64_t arg) {
31416         LDKNetAddress* arg_conv = (LDKNetAddress*)untag_ptr(arg);
31417         int64_t ret_conv = NetAddress_clone_ptr(arg_conv);
31418         return ret_conv;
31419 }
31420
31421 uint64_t  __attribute__((export_name("TS_NetAddress_clone"))) TS_NetAddress_clone(uint64_t orig) {
31422         LDKNetAddress* orig_conv = (LDKNetAddress*)untag_ptr(orig);
31423         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
31424         *ret_copy = NetAddress_clone(orig_conv);
31425         uint64_t ret_ref = tag_ptr(ret_copy, true);
31426         return ret_ref;
31427 }
31428
31429 uint64_t  __attribute__((export_name("TS_NetAddress_ipv4"))) TS_NetAddress_ipv4(int8_tArray addr, int16_t port) {
31430         LDKFourBytes addr_ref;
31431         CHECK(addr->arr_len == 4);
31432         memcpy(addr_ref.data, addr->elems, 4); FREE(addr);
31433         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
31434         *ret_copy = NetAddress_ipv4(addr_ref, port);
31435         uint64_t ret_ref = tag_ptr(ret_copy, true);
31436         return ret_ref;
31437 }
31438
31439 uint64_t  __attribute__((export_name("TS_NetAddress_ipv6"))) TS_NetAddress_ipv6(int8_tArray addr, int16_t port) {
31440         LDKSixteenBytes addr_ref;
31441         CHECK(addr->arr_len == 16);
31442         memcpy(addr_ref.data, addr->elems, 16); FREE(addr);
31443         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
31444         *ret_copy = NetAddress_ipv6(addr_ref, port);
31445         uint64_t ret_ref = tag_ptr(ret_copy, true);
31446         return ret_ref;
31447 }
31448
31449 uint64_t  __attribute__((export_name("TS_NetAddress_onion_v2"))) TS_NetAddress_onion_v2(int8_tArray a) {
31450         LDKTwelveBytes a_ref;
31451         CHECK(a->arr_len == 12);
31452         memcpy(a_ref.data, a->elems, 12); FREE(a);
31453         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
31454         *ret_copy = NetAddress_onion_v2(a_ref);
31455         uint64_t ret_ref = tag_ptr(ret_copy, true);
31456         return ret_ref;
31457 }
31458
31459 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) {
31460         LDKThirtyTwoBytes ed25519_pubkey_ref;
31461         CHECK(ed25519_pubkey->arr_len == 32);
31462         memcpy(ed25519_pubkey_ref.data, ed25519_pubkey->elems, 32); FREE(ed25519_pubkey);
31463         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
31464         *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
31465         uint64_t ret_ref = tag_ptr(ret_copy, true);
31466         return ret_ref;
31467 }
31468
31469 uint64_t  __attribute__((export_name("TS_NetAddress_hostname"))) TS_NetAddress_hostname(uint64_t hostname, int16_t port) {
31470         LDKHostname hostname_conv;
31471         hostname_conv.inner = untag_ptr(hostname);
31472         hostname_conv.is_owned = ptr_is_owned(hostname);
31473         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_conv);
31474         hostname_conv = Hostname_clone(&hostname_conv);
31475         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
31476         *ret_copy = NetAddress_hostname(hostname_conv, port);
31477         uint64_t ret_ref = tag_ptr(ret_copy, true);
31478         return ret_ref;
31479 }
31480
31481 int8_tArray  __attribute__((export_name("TS_NetAddress_write"))) TS_NetAddress_write(uint64_t obj) {
31482         LDKNetAddress* obj_conv = (LDKNetAddress*)untag_ptr(obj);
31483         LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
31484         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31485         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31486         CVec_u8Z_free(ret_var);
31487         return ret_arr;
31488 }
31489
31490 uint64_t  __attribute__((export_name("TS_NetAddress_read"))) TS_NetAddress_read(int8_tArray ser) {
31491         LDKu8slice ser_ref;
31492         ser_ref.datalen = ser->arr_len;
31493         ser_ref.data = ser->elems;
31494         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
31495         *ret_conv = NetAddress_read(ser_ref);
31496         FREE(ser);
31497         return tag_ptr(ret_conv, true);
31498 }
31499
31500 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_free"))) TS_UnsignedNodeAnnouncement_free(uint64_t this_obj) {
31501         LDKUnsignedNodeAnnouncement this_obj_conv;
31502         this_obj_conv.inner = untag_ptr(this_obj);
31503         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31505         UnsignedNodeAnnouncement_free(this_obj_conv);
31506 }
31507
31508 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_features"))) TS_UnsignedNodeAnnouncement_get_features(uint64_t this_ptr) {
31509         LDKUnsignedNodeAnnouncement this_ptr_conv;
31510         this_ptr_conv.inner = untag_ptr(this_ptr);
31511         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31513         this_ptr_conv.is_owned = false;
31514         LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
31515         uint64_t ret_ref = 0;
31516         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31517         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31518         return ret_ref;
31519 }
31520
31521 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_features"))) TS_UnsignedNodeAnnouncement_set_features(uint64_t this_ptr, uint64_t val) {
31522         LDKUnsignedNodeAnnouncement this_ptr_conv;
31523         this_ptr_conv.inner = untag_ptr(this_ptr);
31524         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31526         this_ptr_conv.is_owned = false;
31527         LDKNodeFeatures val_conv;
31528         val_conv.inner = untag_ptr(val);
31529         val_conv.is_owned = ptr_is_owned(val);
31530         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31531         val_conv = NodeFeatures_clone(&val_conv);
31532         UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
31533 }
31534
31535 int32_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_timestamp"))) TS_UnsignedNodeAnnouncement_get_timestamp(uint64_t this_ptr) {
31536         LDKUnsignedNodeAnnouncement this_ptr_conv;
31537         this_ptr_conv.inner = untag_ptr(this_ptr);
31538         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31540         this_ptr_conv.is_owned = false;
31541         int32_t ret_conv = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
31542         return ret_conv;
31543 }
31544
31545 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_timestamp"))) TS_UnsignedNodeAnnouncement_set_timestamp(uint64_t this_ptr, int32_t val) {
31546         LDKUnsignedNodeAnnouncement this_ptr_conv;
31547         this_ptr_conv.inner = untag_ptr(this_ptr);
31548         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31550         this_ptr_conv.is_owned = false;
31551         UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
31552 }
31553
31554 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_node_id"))) TS_UnsignedNodeAnnouncement_get_node_id(uint64_t this_ptr) {
31555         LDKUnsignedNodeAnnouncement this_ptr_conv;
31556         this_ptr_conv.inner = untag_ptr(this_ptr);
31557         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31559         this_ptr_conv.is_owned = false;
31560         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31561         memcpy(ret_arr->elems, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form, 33);
31562         return ret_arr;
31563 }
31564
31565 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_node_id"))) TS_UnsignedNodeAnnouncement_set_node_id(uint64_t this_ptr, int8_tArray val) {
31566         LDKUnsignedNodeAnnouncement this_ptr_conv;
31567         this_ptr_conv.inner = untag_ptr(this_ptr);
31568         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31570         this_ptr_conv.is_owned = false;
31571         LDKPublicKey val_ref;
31572         CHECK(val->arr_len == 33);
31573         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31574         UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
31575 }
31576
31577 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_rgb"))) TS_UnsignedNodeAnnouncement_get_rgb(uint64_t this_ptr) {
31578         LDKUnsignedNodeAnnouncement this_ptr_conv;
31579         this_ptr_conv.inner = untag_ptr(this_ptr);
31580         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31582         this_ptr_conv.is_owned = false;
31583         int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
31584         memcpy(ret_arr->elems, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv), 3);
31585         return ret_arr;
31586 }
31587
31588 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_rgb"))) TS_UnsignedNodeAnnouncement_set_rgb(uint64_t this_ptr, int8_tArray val) {
31589         LDKUnsignedNodeAnnouncement this_ptr_conv;
31590         this_ptr_conv.inner = untag_ptr(this_ptr);
31591         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31593         this_ptr_conv.is_owned = false;
31594         LDKThreeBytes val_ref;
31595         CHECK(val->arr_len == 3);
31596         memcpy(val_ref.data, val->elems, 3); FREE(val);
31597         UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
31598 }
31599
31600 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_alias"))) TS_UnsignedNodeAnnouncement_get_alias(uint64_t this_ptr) {
31601         LDKUnsignedNodeAnnouncement this_ptr_conv;
31602         this_ptr_conv.inner = untag_ptr(this_ptr);
31603         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31605         this_ptr_conv.is_owned = false;
31606         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31607         memcpy(ret_arr->elems, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv), 32);
31608         return ret_arr;
31609 }
31610
31611 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_alias"))) TS_UnsignedNodeAnnouncement_set_alias(uint64_t this_ptr, int8_tArray val) {
31612         LDKUnsignedNodeAnnouncement this_ptr_conv;
31613         this_ptr_conv.inner = untag_ptr(this_ptr);
31614         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31616         this_ptr_conv.is_owned = false;
31617         LDKThirtyTwoBytes val_ref;
31618         CHECK(val->arr_len == 32);
31619         memcpy(val_ref.data, val->elems, 32); FREE(val);
31620         UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
31621 }
31622
31623 uint64_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_addresses"))) TS_UnsignedNodeAnnouncement_get_addresses(uint64_t this_ptr) {
31624         LDKUnsignedNodeAnnouncement this_ptr_conv;
31625         this_ptr_conv.inner = untag_ptr(this_ptr);
31626         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31628         this_ptr_conv.is_owned = false;
31629         LDKCVec_NetAddressZ ret_var = UnsignedNodeAnnouncement_get_addresses(&this_ptr_conv);
31630         uint64_tArray ret_arr = NULL;
31631         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
31632         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
31633         for (size_t m = 0; m < ret_var.datalen; m++) {
31634                 LDKNetAddress *ret_conv_12_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
31635                 *ret_conv_12_copy = ret_var.data[m];
31636                 uint64_t ret_conv_12_ref = tag_ptr(ret_conv_12_copy, true);
31637                 ret_arr_ptr[m] = ret_conv_12_ref;
31638         }
31639         
31640         FREE(ret_var.data);
31641         return ret_arr;
31642 }
31643
31644 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_addresses"))) TS_UnsignedNodeAnnouncement_set_addresses(uint64_t this_ptr, uint64_tArray val) {
31645         LDKUnsignedNodeAnnouncement this_ptr_conv;
31646         this_ptr_conv.inner = untag_ptr(this_ptr);
31647         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31648         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31649         this_ptr_conv.is_owned = false;
31650         LDKCVec_NetAddressZ val_constr;
31651         val_constr.datalen = val->arr_len;
31652         if (val_constr.datalen > 0)
31653                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
31654         else
31655                 val_constr.data = NULL;
31656         uint64_t* val_vals = val->elems;
31657         for (size_t m = 0; m < val_constr.datalen; m++) {
31658                 uint64_t val_conv_12 = val_vals[m];
31659                 void* val_conv_12_ptr = untag_ptr(val_conv_12);
31660                 CHECK_ACCESS(val_conv_12_ptr);
31661                 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
31662                 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(val_conv_12));
31663                 val_constr.data[m] = val_conv_12_conv;
31664         }
31665         FREE(val);
31666         UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
31667 }
31668
31669 static inline uint64_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
31670         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
31671         uint64_t ret_ref = 0;
31672         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31673         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31674         return ret_ref;
31675 }
31676 int64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone_ptr"))) TS_UnsignedNodeAnnouncement_clone_ptr(uint64_t arg) {
31677         LDKUnsignedNodeAnnouncement arg_conv;
31678         arg_conv.inner = untag_ptr(arg);
31679         arg_conv.is_owned = ptr_is_owned(arg);
31680         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31681         arg_conv.is_owned = false;
31682         int64_t ret_conv = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
31683         return ret_conv;
31684 }
31685
31686 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone"))) TS_UnsignedNodeAnnouncement_clone(uint64_t orig) {
31687         LDKUnsignedNodeAnnouncement orig_conv;
31688         orig_conv.inner = untag_ptr(orig);
31689         orig_conv.is_owned = ptr_is_owned(orig);
31690         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31691         orig_conv.is_owned = false;
31692         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
31693         uint64_t ret_ref = 0;
31694         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31695         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31696         return ret_ref;
31697 }
31698
31699 void  __attribute__((export_name("TS_NodeAnnouncement_free"))) TS_NodeAnnouncement_free(uint64_t this_obj) {
31700         LDKNodeAnnouncement this_obj_conv;
31701         this_obj_conv.inner = untag_ptr(this_obj);
31702         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31704         NodeAnnouncement_free(this_obj_conv);
31705 }
31706
31707 int8_tArray  __attribute__((export_name("TS_NodeAnnouncement_get_signature"))) TS_NodeAnnouncement_get_signature(uint64_t this_ptr) {
31708         LDKNodeAnnouncement this_ptr_conv;
31709         this_ptr_conv.inner = untag_ptr(this_ptr);
31710         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31712         this_ptr_conv.is_owned = false;
31713         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
31714         memcpy(ret_arr->elems, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64);
31715         return ret_arr;
31716 }
31717
31718 void  __attribute__((export_name("TS_NodeAnnouncement_set_signature"))) TS_NodeAnnouncement_set_signature(uint64_t this_ptr, int8_tArray val) {
31719         LDKNodeAnnouncement this_ptr_conv;
31720         this_ptr_conv.inner = untag_ptr(this_ptr);
31721         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31723         this_ptr_conv.is_owned = false;
31724         LDKSignature val_ref;
31725         CHECK(val->arr_len == 64);
31726         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
31727         NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
31728 }
31729
31730 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_get_contents"))) TS_NodeAnnouncement_get_contents(uint64_t this_ptr) {
31731         LDKNodeAnnouncement this_ptr_conv;
31732         this_ptr_conv.inner = untag_ptr(this_ptr);
31733         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31735         this_ptr_conv.is_owned = false;
31736         LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
31737         uint64_t ret_ref = 0;
31738         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31739         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31740         return ret_ref;
31741 }
31742
31743 void  __attribute__((export_name("TS_NodeAnnouncement_set_contents"))) TS_NodeAnnouncement_set_contents(uint64_t this_ptr, uint64_t val) {
31744         LDKNodeAnnouncement this_ptr_conv;
31745         this_ptr_conv.inner = untag_ptr(this_ptr);
31746         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31747         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31748         this_ptr_conv.is_owned = false;
31749         LDKUnsignedNodeAnnouncement val_conv;
31750         val_conv.inner = untag_ptr(val);
31751         val_conv.is_owned = ptr_is_owned(val);
31752         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31753         val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
31754         NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
31755 }
31756
31757 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_new"))) TS_NodeAnnouncement_new(int8_tArray signature_arg, uint64_t contents_arg) {
31758         LDKSignature signature_arg_ref;
31759         CHECK(signature_arg->arr_len == 64);
31760         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
31761         LDKUnsignedNodeAnnouncement contents_arg_conv;
31762         contents_arg_conv.inner = untag_ptr(contents_arg);
31763         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
31764         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
31765         contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
31766         LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
31767         uint64_t ret_ref = 0;
31768         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31769         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31770         return ret_ref;
31771 }
31772
31773 static inline uint64_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
31774         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
31775         uint64_t ret_ref = 0;
31776         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31777         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31778         return ret_ref;
31779 }
31780 int64_t  __attribute__((export_name("TS_NodeAnnouncement_clone_ptr"))) TS_NodeAnnouncement_clone_ptr(uint64_t arg) {
31781         LDKNodeAnnouncement arg_conv;
31782         arg_conv.inner = untag_ptr(arg);
31783         arg_conv.is_owned = ptr_is_owned(arg);
31784         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31785         arg_conv.is_owned = false;
31786         int64_t ret_conv = NodeAnnouncement_clone_ptr(&arg_conv);
31787         return ret_conv;
31788 }
31789
31790 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_clone"))) TS_NodeAnnouncement_clone(uint64_t orig) {
31791         LDKNodeAnnouncement orig_conv;
31792         orig_conv.inner = untag_ptr(orig);
31793         orig_conv.is_owned = ptr_is_owned(orig);
31794         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31795         orig_conv.is_owned = false;
31796         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
31797         uint64_t ret_ref = 0;
31798         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31799         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31800         return ret_ref;
31801 }
31802
31803 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_free"))) TS_UnsignedChannelAnnouncement_free(uint64_t this_obj) {
31804         LDKUnsignedChannelAnnouncement this_obj_conv;
31805         this_obj_conv.inner = untag_ptr(this_obj);
31806         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31808         UnsignedChannelAnnouncement_free(this_obj_conv);
31809 }
31810
31811 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_features"))) TS_UnsignedChannelAnnouncement_get_features(uint64_t this_ptr) {
31812         LDKUnsignedChannelAnnouncement this_ptr_conv;
31813         this_ptr_conv.inner = untag_ptr(this_ptr);
31814         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31816         this_ptr_conv.is_owned = false;
31817         LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
31818         uint64_t ret_ref = 0;
31819         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31820         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31821         return ret_ref;
31822 }
31823
31824 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_features"))) TS_UnsignedChannelAnnouncement_set_features(uint64_t this_ptr, uint64_t val) {
31825         LDKUnsignedChannelAnnouncement this_ptr_conv;
31826         this_ptr_conv.inner = untag_ptr(this_ptr);
31827         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31829         this_ptr_conv.is_owned = false;
31830         LDKChannelFeatures val_conv;
31831         val_conv.inner = untag_ptr(val);
31832         val_conv.is_owned = ptr_is_owned(val);
31833         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31834         val_conv = ChannelFeatures_clone(&val_conv);
31835         UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
31836 }
31837
31838 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_chain_hash"))) TS_UnsignedChannelAnnouncement_get_chain_hash(uint64_t this_ptr) {
31839         LDKUnsignedChannelAnnouncement this_ptr_conv;
31840         this_ptr_conv.inner = untag_ptr(this_ptr);
31841         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31843         this_ptr_conv.is_owned = false;
31844         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31845         memcpy(ret_arr->elems, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv), 32);
31846         return ret_arr;
31847 }
31848
31849 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_chain_hash"))) TS_UnsignedChannelAnnouncement_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
31850         LDKUnsignedChannelAnnouncement this_ptr_conv;
31851         this_ptr_conv.inner = untag_ptr(this_ptr);
31852         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31854         this_ptr_conv.is_owned = false;
31855         LDKThirtyTwoBytes val_ref;
31856         CHECK(val->arr_len == 32);
31857         memcpy(val_ref.data, val->elems, 32); FREE(val);
31858         UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
31859 }
31860
31861 int64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_short_channel_id"))) TS_UnsignedChannelAnnouncement_get_short_channel_id(uint64_t this_ptr) {
31862         LDKUnsignedChannelAnnouncement this_ptr_conv;
31863         this_ptr_conv.inner = untag_ptr(this_ptr);
31864         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31866         this_ptr_conv.is_owned = false;
31867         int64_t ret_conv = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
31868         return ret_conv;
31869 }
31870
31871 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_short_channel_id"))) TS_UnsignedChannelAnnouncement_set_short_channel_id(uint64_t this_ptr, int64_t val) {
31872         LDKUnsignedChannelAnnouncement this_ptr_conv;
31873         this_ptr_conv.inner = untag_ptr(this_ptr);
31874         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31876         this_ptr_conv.is_owned = false;
31877         UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
31878 }
31879
31880 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_1"))) TS_UnsignedChannelAnnouncement_get_node_id_1(uint64_t this_ptr) {
31881         LDKUnsignedChannelAnnouncement this_ptr_conv;
31882         this_ptr_conv.inner = untag_ptr(this_ptr);
31883         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31884         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31885         this_ptr_conv.is_owned = false;
31886         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31887         memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form, 33);
31888         return ret_arr;
31889 }
31890
31891 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_1"))) TS_UnsignedChannelAnnouncement_set_node_id_1(uint64_t this_ptr, int8_tArray val) {
31892         LDKUnsignedChannelAnnouncement this_ptr_conv;
31893         this_ptr_conv.inner = untag_ptr(this_ptr);
31894         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31896         this_ptr_conv.is_owned = false;
31897         LDKPublicKey val_ref;
31898         CHECK(val->arr_len == 33);
31899         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31900         UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
31901 }
31902
31903 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_2"))) TS_UnsignedChannelAnnouncement_get_node_id_2(uint64_t this_ptr) {
31904         LDKUnsignedChannelAnnouncement this_ptr_conv;
31905         this_ptr_conv.inner = untag_ptr(this_ptr);
31906         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31908         this_ptr_conv.is_owned = false;
31909         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31910         memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form, 33);
31911         return ret_arr;
31912 }
31913
31914 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_2"))) TS_UnsignedChannelAnnouncement_set_node_id_2(uint64_t this_ptr, int8_tArray val) {
31915         LDKUnsignedChannelAnnouncement this_ptr_conv;
31916         this_ptr_conv.inner = untag_ptr(this_ptr);
31917         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31919         this_ptr_conv.is_owned = false;
31920         LDKPublicKey val_ref;
31921         CHECK(val->arr_len == 33);
31922         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31923         UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
31924 }
31925
31926 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_1(uint64_t this_ptr) {
31927         LDKUnsignedChannelAnnouncement this_ptr_conv;
31928         this_ptr_conv.inner = untag_ptr(this_ptr);
31929         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31931         this_ptr_conv.is_owned = false;
31932         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31933         memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form, 33);
31934         return ret_arr;
31935 }
31936
31937 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_1(uint64_t this_ptr, int8_tArray val) {
31938         LDKUnsignedChannelAnnouncement this_ptr_conv;
31939         this_ptr_conv.inner = untag_ptr(this_ptr);
31940         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31942         this_ptr_conv.is_owned = false;
31943         LDKPublicKey val_ref;
31944         CHECK(val->arr_len == 33);
31945         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31946         UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
31947 }
31948
31949 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_2(uint64_t this_ptr) {
31950         LDKUnsignedChannelAnnouncement this_ptr_conv;
31951         this_ptr_conv.inner = untag_ptr(this_ptr);
31952         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31954         this_ptr_conv.is_owned = false;
31955         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31956         memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form, 33);
31957         return ret_arr;
31958 }
31959
31960 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_2(uint64_t this_ptr, int8_tArray val) {
31961         LDKUnsignedChannelAnnouncement this_ptr_conv;
31962         this_ptr_conv.inner = untag_ptr(this_ptr);
31963         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31965         this_ptr_conv.is_owned = false;
31966         LDKPublicKey val_ref;
31967         CHECK(val->arr_len == 33);
31968         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31969         UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
31970 }
31971
31972 static inline uint64_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
31973         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
31974         uint64_t ret_ref = 0;
31975         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31976         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31977         return ret_ref;
31978 }
31979 int64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone_ptr"))) TS_UnsignedChannelAnnouncement_clone_ptr(uint64_t arg) {
31980         LDKUnsignedChannelAnnouncement arg_conv;
31981         arg_conv.inner = untag_ptr(arg);
31982         arg_conv.is_owned = ptr_is_owned(arg);
31983         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31984         arg_conv.is_owned = false;
31985         int64_t ret_conv = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
31986         return ret_conv;
31987 }
31988
31989 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone"))) TS_UnsignedChannelAnnouncement_clone(uint64_t orig) {
31990         LDKUnsignedChannelAnnouncement orig_conv;
31991         orig_conv.inner = untag_ptr(orig);
31992         orig_conv.is_owned = ptr_is_owned(orig);
31993         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31994         orig_conv.is_owned = false;
31995         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
31996         uint64_t ret_ref = 0;
31997         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31998         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31999         return ret_ref;
32000 }
32001
32002 void  __attribute__((export_name("TS_ChannelAnnouncement_free"))) TS_ChannelAnnouncement_free(uint64_t this_obj) {
32003         LDKChannelAnnouncement this_obj_conv;
32004         this_obj_conv.inner = untag_ptr(this_obj);
32005         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32007         ChannelAnnouncement_free(this_obj_conv);
32008 }
32009
32010 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_1"))) TS_ChannelAnnouncement_get_node_signature_1(uint64_t this_ptr) {
32011         LDKChannelAnnouncement this_ptr_conv;
32012         this_ptr_conv.inner = untag_ptr(this_ptr);
32013         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32014         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32015         this_ptr_conv.is_owned = false;
32016         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
32017         memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64);
32018         return ret_arr;
32019 }
32020
32021 void  __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_1"))) TS_ChannelAnnouncement_set_node_signature_1(uint64_t this_ptr, int8_tArray val) {
32022         LDKChannelAnnouncement this_ptr_conv;
32023         this_ptr_conv.inner = untag_ptr(this_ptr);
32024         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32025         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32026         this_ptr_conv.is_owned = false;
32027         LDKSignature val_ref;
32028         CHECK(val->arr_len == 64);
32029         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
32030         ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
32031 }
32032
32033 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_2"))) TS_ChannelAnnouncement_get_node_signature_2(uint64_t this_ptr) {
32034         LDKChannelAnnouncement this_ptr_conv;
32035         this_ptr_conv.inner = untag_ptr(this_ptr);
32036         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32038         this_ptr_conv.is_owned = false;
32039         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
32040         memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64);
32041         return ret_arr;
32042 }
32043
32044 void  __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_2"))) TS_ChannelAnnouncement_set_node_signature_2(uint64_t this_ptr, int8_tArray val) {
32045         LDKChannelAnnouncement this_ptr_conv;
32046         this_ptr_conv.inner = untag_ptr(this_ptr);
32047         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32049         this_ptr_conv.is_owned = false;
32050         LDKSignature val_ref;
32051         CHECK(val->arr_len == 64);
32052         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
32053         ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
32054 }
32055
32056 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_1"))) TS_ChannelAnnouncement_get_bitcoin_signature_1(uint64_t this_ptr) {
32057         LDKChannelAnnouncement this_ptr_conv;
32058         this_ptr_conv.inner = untag_ptr(this_ptr);
32059         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32061         this_ptr_conv.is_owned = false;
32062         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
32063         memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64);
32064         return ret_arr;
32065 }
32066
32067 void  __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_1"))) TS_ChannelAnnouncement_set_bitcoin_signature_1(uint64_t this_ptr, int8_tArray val) {
32068         LDKChannelAnnouncement this_ptr_conv;
32069         this_ptr_conv.inner = untag_ptr(this_ptr);
32070         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32071         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32072         this_ptr_conv.is_owned = false;
32073         LDKSignature val_ref;
32074         CHECK(val->arr_len == 64);
32075         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
32076         ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
32077 }
32078
32079 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_2"))) TS_ChannelAnnouncement_get_bitcoin_signature_2(uint64_t this_ptr) {
32080         LDKChannelAnnouncement this_ptr_conv;
32081         this_ptr_conv.inner = untag_ptr(this_ptr);
32082         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32084         this_ptr_conv.is_owned = false;
32085         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
32086         memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64);
32087         return ret_arr;
32088 }
32089
32090 void  __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_2"))) TS_ChannelAnnouncement_set_bitcoin_signature_2(uint64_t this_ptr, int8_tArray val) {
32091         LDKChannelAnnouncement this_ptr_conv;
32092         this_ptr_conv.inner = untag_ptr(this_ptr);
32093         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32095         this_ptr_conv.is_owned = false;
32096         LDKSignature val_ref;
32097         CHECK(val->arr_len == 64);
32098         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
32099         ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
32100 }
32101
32102 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_get_contents"))) TS_ChannelAnnouncement_get_contents(uint64_t this_ptr) {
32103         LDKChannelAnnouncement this_ptr_conv;
32104         this_ptr_conv.inner = untag_ptr(this_ptr);
32105         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32107         this_ptr_conv.is_owned = false;
32108         LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
32109         uint64_t ret_ref = 0;
32110         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32111         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32112         return ret_ref;
32113 }
32114
32115 void  __attribute__((export_name("TS_ChannelAnnouncement_set_contents"))) TS_ChannelAnnouncement_set_contents(uint64_t this_ptr, uint64_t val) {
32116         LDKChannelAnnouncement this_ptr_conv;
32117         this_ptr_conv.inner = untag_ptr(this_ptr);
32118         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32120         this_ptr_conv.is_owned = false;
32121         LDKUnsignedChannelAnnouncement val_conv;
32122         val_conv.inner = untag_ptr(val);
32123         val_conv.is_owned = ptr_is_owned(val);
32124         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32125         val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
32126         ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
32127 }
32128
32129 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) {
32130         LDKSignature node_signature_1_arg_ref;
32131         CHECK(node_signature_1_arg->arr_len == 64);
32132         memcpy(node_signature_1_arg_ref.compact_form, node_signature_1_arg->elems, 64); FREE(node_signature_1_arg);
32133         LDKSignature node_signature_2_arg_ref;
32134         CHECK(node_signature_2_arg->arr_len == 64);
32135         memcpy(node_signature_2_arg_ref.compact_form, node_signature_2_arg->elems, 64); FREE(node_signature_2_arg);
32136         LDKSignature bitcoin_signature_1_arg_ref;
32137         CHECK(bitcoin_signature_1_arg->arr_len == 64);
32138         memcpy(bitcoin_signature_1_arg_ref.compact_form, bitcoin_signature_1_arg->elems, 64); FREE(bitcoin_signature_1_arg);
32139         LDKSignature bitcoin_signature_2_arg_ref;
32140         CHECK(bitcoin_signature_2_arg->arr_len == 64);
32141         memcpy(bitcoin_signature_2_arg_ref.compact_form, bitcoin_signature_2_arg->elems, 64); FREE(bitcoin_signature_2_arg);
32142         LDKUnsignedChannelAnnouncement contents_arg_conv;
32143         contents_arg_conv.inner = untag_ptr(contents_arg);
32144         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
32145         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
32146         contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
32147         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);
32148         uint64_t ret_ref = 0;
32149         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32150         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32151         return ret_ref;
32152 }
32153
32154 static inline uint64_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
32155         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
32156         uint64_t ret_ref = 0;
32157         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32158         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32159         return ret_ref;
32160 }
32161 int64_t  __attribute__((export_name("TS_ChannelAnnouncement_clone_ptr"))) TS_ChannelAnnouncement_clone_ptr(uint64_t arg) {
32162         LDKChannelAnnouncement arg_conv;
32163         arg_conv.inner = untag_ptr(arg);
32164         arg_conv.is_owned = ptr_is_owned(arg);
32165         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32166         arg_conv.is_owned = false;
32167         int64_t ret_conv = ChannelAnnouncement_clone_ptr(&arg_conv);
32168         return ret_conv;
32169 }
32170
32171 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_clone"))) TS_ChannelAnnouncement_clone(uint64_t orig) {
32172         LDKChannelAnnouncement orig_conv;
32173         orig_conv.inner = untag_ptr(orig);
32174         orig_conv.is_owned = ptr_is_owned(orig);
32175         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32176         orig_conv.is_owned = false;
32177         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
32178         uint64_t ret_ref = 0;
32179         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32180         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32181         return ret_ref;
32182 }
32183
32184 void  __attribute__((export_name("TS_UnsignedChannelUpdate_free"))) TS_UnsignedChannelUpdate_free(uint64_t this_obj) {
32185         LDKUnsignedChannelUpdate this_obj_conv;
32186         this_obj_conv.inner = untag_ptr(this_obj);
32187         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32189         UnsignedChannelUpdate_free(this_obj_conv);
32190 }
32191
32192 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_get_chain_hash"))) TS_UnsignedChannelUpdate_get_chain_hash(uint64_t this_ptr) {
32193         LDKUnsignedChannelUpdate this_ptr_conv;
32194         this_ptr_conv.inner = untag_ptr(this_ptr);
32195         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32197         this_ptr_conv.is_owned = false;
32198         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32199         memcpy(ret_arr->elems, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv), 32);
32200         return ret_arr;
32201 }
32202
32203 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_chain_hash"))) TS_UnsignedChannelUpdate_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
32204         LDKUnsignedChannelUpdate this_ptr_conv;
32205         this_ptr_conv.inner = untag_ptr(this_ptr);
32206         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32208         this_ptr_conv.is_owned = false;
32209         LDKThirtyTwoBytes val_ref;
32210         CHECK(val->arr_len == 32);
32211         memcpy(val_ref.data, val->elems, 32); FREE(val);
32212         UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
32213 }
32214
32215 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_short_channel_id"))) TS_UnsignedChannelUpdate_get_short_channel_id(uint64_t this_ptr) {
32216         LDKUnsignedChannelUpdate this_ptr_conv;
32217         this_ptr_conv.inner = untag_ptr(this_ptr);
32218         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32220         this_ptr_conv.is_owned = false;
32221         int64_t ret_conv = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
32222         return ret_conv;
32223 }
32224
32225 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_short_channel_id"))) TS_UnsignedChannelUpdate_set_short_channel_id(uint64_t this_ptr, int64_t val) {
32226         LDKUnsignedChannelUpdate this_ptr_conv;
32227         this_ptr_conv.inner = untag_ptr(this_ptr);
32228         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32230         this_ptr_conv.is_owned = false;
32231         UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
32232 }
32233
32234 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_timestamp"))) TS_UnsignedChannelUpdate_get_timestamp(uint64_t this_ptr) {
32235         LDKUnsignedChannelUpdate this_ptr_conv;
32236         this_ptr_conv.inner = untag_ptr(this_ptr);
32237         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32239         this_ptr_conv.is_owned = false;
32240         int32_t ret_conv = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
32241         return ret_conv;
32242 }
32243
32244 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_timestamp"))) TS_UnsignedChannelUpdate_set_timestamp(uint64_t this_ptr, int32_t val) {
32245         LDKUnsignedChannelUpdate this_ptr_conv;
32246         this_ptr_conv.inner = untag_ptr(this_ptr);
32247         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32249         this_ptr_conv.is_owned = false;
32250         UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
32251 }
32252
32253 int8_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_flags"))) TS_UnsignedChannelUpdate_get_flags(uint64_t this_ptr) {
32254         LDKUnsignedChannelUpdate this_ptr_conv;
32255         this_ptr_conv.inner = untag_ptr(this_ptr);
32256         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32258         this_ptr_conv.is_owned = false;
32259         int8_t ret_conv = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
32260         return ret_conv;
32261 }
32262
32263 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_flags"))) TS_UnsignedChannelUpdate_set_flags(uint64_t this_ptr, int8_t val) {
32264         LDKUnsignedChannelUpdate this_ptr_conv;
32265         this_ptr_conv.inner = untag_ptr(this_ptr);
32266         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32268         this_ptr_conv.is_owned = false;
32269         UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
32270 }
32271
32272 int16_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_get_cltv_expiry_delta(uint64_t this_ptr) {
32273         LDKUnsignedChannelUpdate this_ptr_conv;
32274         this_ptr_conv.inner = untag_ptr(this_ptr);
32275         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32277         this_ptr_conv.is_owned = false;
32278         int16_t ret_conv = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
32279         return ret_conv;
32280 }
32281
32282 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
32283         LDKUnsignedChannelUpdate this_ptr_conv;
32284         this_ptr_conv.inner = untag_ptr(this_ptr);
32285         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32287         this_ptr_conv.is_owned = false;
32288         UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
32289 }
32290
32291 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_get_htlc_minimum_msat(uint64_t this_ptr) {
32292         LDKUnsignedChannelUpdate this_ptr_conv;
32293         this_ptr_conv.inner = untag_ptr(this_ptr);
32294         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32296         this_ptr_conv.is_owned = false;
32297         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
32298         return ret_conv;
32299 }
32300
32301 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
32302         LDKUnsignedChannelUpdate this_ptr_conv;
32303         this_ptr_conv.inner = untag_ptr(this_ptr);
32304         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32306         this_ptr_conv.is_owned = false;
32307         UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
32308 }
32309
32310 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_htlc_maximum_msat"))) TS_UnsignedChannelUpdate_get_htlc_maximum_msat(uint64_t this_ptr) {
32311         LDKUnsignedChannelUpdate this_ptr_conv;
32312         this_ptr_conv.inner = untag_ptr(this_ptr);
32313         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32315         this_ptr_conv.is_owned = false;
32316         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_maximum_msat(&this_ptr_conv);
32317         return ret_conv;
32318 }
32319
32320 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_htlc_maximum_msat"))) TS_UnsignedChannelUpdate_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
32321         LDKUnsignedChannelUpdate this_ptr_conv;
32322         this_ptr_conv.inner = untag_ptr(this_ptr);
32323         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32325         this_ptr_conv.is_owned = false;
32326         UnsignedChannelUpdate_set_htlc_maximum_msat(&this_ptr_conv, val);
32327 }
32328
32329 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_base_msat"))) TS_UnsignedChannelUpdate_get_fee_base_msat(uint64_t this_ptr) {
32330         LDKUnsignedChannelUpdate this_ptr_conv;
32331         this_ptr_conv.inner = untag_ptr(this_ptr);
32332         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32333         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32334         this_ptr_conv.is_owned = false;
32335         int32_t ret_conv = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
32336         return ret_conv;
32337 }
32338
32339 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_base_msat"))) TS_UnsignedChannelUpdate_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
32340         LDKUnsignedChannelUpdate this_ptr_conv;
32341         this_ptr_conv.inner = untag_ptr(this_ptr);
32342         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32344         this_ptr_conv.is_owned = false;
32345         UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
32346 }
32347
32348 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_get_fee_proportional_millionths(uint64_t this_ptr) {
32349         LDKUnsignedChannelUpdate this_ptr_conv;
32350         this_ptr_conv.inner = untag_ptr(this_ptr);
32351         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32353         this_ptr_conv.is_owned = false;
32354         int32_t ret_conv = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
32355         return ret_conv;
32356 }
32357
32358 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
32359         LDKUnsignedChannelUpdate this_ptr_conv;
32360         this_ptr_conv.inner = untag_ptr(this_ptr);
32361         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32362         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32363         this_ptr_conv.is_owned = false;
32364         UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
32365 }
32366
32367 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_get_excess_data"))) TS_UnsignedChannelUpdate_get_excess_data(uint64_t this_ptr) {
32368         LDKUnsignedChannelUpdate this_ptr_conv;
32369         this_ptr_conv.inner = untag_ptr(this_ptr);
32370         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32371         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32372         this_ptr_conv.is_owned = false;
32373         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_get_excess_data(&this_ptr_conv);
32374         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32375         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32376         CVec_u8Z_free(ret_var);
32377         return ret_arr;
32378 }
32379
32380 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_excess_data"))) TS_UnsignedChannelUpdate_set_excess_data(uint64_t this_ptr, int8_tArray val) {
32381         LDKUnsignedChannelUpdate this_ptr_conv;
32382         this_ptr_conv.inner = untag_ptr(this_ptr);
32383         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32385         this_ptr_conv.is_owned = false;
32386         LDKCVec_u8Z val_ref;
32387         val_ref.datalen = val->arr_len;
32388         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
32389         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
32390         UnsignedChannelUpdate_set_excess_data(&this_ptr_conv, val_ref);
32391 }
32392
32393 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) {
32394         LDKThirtyTwoBytes chain_hash_arg_ref;
32395         CHECK(chain_hash_arg->arr_len == 32);
32396         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
32397         LDKCVec_u8Z excess_data_arg_ref;
32398         excess_data_arg_ref.datalen = excess_data_arg->arr_len;
32399         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
32400         memcpy(excess_data_arg_ref.data, excess_data_arg->elems, excess_data_arg_ref.datalen); FREE(excess_data_arg);
32401         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);
32402         uint64_t ret_ref = 0;
32403         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32404         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32405         return ret_ref;
32406 }
32407
32408 static inline uint64_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
32409         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
32410         uint64_t ret_ref = 0;
32411         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32412         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32413         return ret_ref;
32414 }
32415 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_clone_ptr"))) TS_UnsignedChannelUpdate_clone_ptr(uint64_t arg) {
32416         LDKUnsignedChannelUpdate arg_conv;
32417         arg_conv.inner = untag_ptr(arg);
32418         arg_conv.is_owned = ptr_is_owned(arg);
32419         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32420         arg_conv.is_owned = false;
32421         int64_t ret_conv = UnsignedChannelUpdate_clone_ptr(&arg_conv);
32422         return ret_conv;
32423 }
32424
32425 uint64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_clone"))) TS_UnsignedChannelUpdate_clone(uint64_t orig) {
32426         LDKUnsignedChannelUpdate orig_conv;
32427         orig_conv.inner = untag_ptr(orig);
32428         orig_conv.is_owned = ptr_is_owned(orig);
32429         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32430         orig_conv.is_owned = false;
32431         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
32432         uint64_t ret_ref = 0;
32433         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32434         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32435         return ret_ref;
32436 }
32437
32438 void  __attribute__((export_name("TS_ChannelUpdate_free"))) TS_ChannelUpdate_free(uint64_t this_obj) {
32439         LDKChannelUpdate this_obj_conv;
32440         this_obj_conv.inner = untag_ptr(this_obj);
32441         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32443         ChannelUpdate_free(this_obj_conv);
32444 }
32445
32446 int8_tArray  __attribute__((export_name("TS_ChannelUpdate_get_signature"))) TS_ChannelUpdate_get_signature(uint64_t this_ptr) {
32447         LDKChannelUpdate this_ptr_conv;
32448         this_ptr_conv.inner = untag_ptr(this_ptr);
32449         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32451         this_ptr_conv.is_owned = false;
32452         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
32453         memcpy(ret_arr->elems, ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64);
32454         return ret_arr;
32455 }
32456
32457 void  __attribute__((export_name("TS_ChannelUpdate_set_signature"))) TS_ChannelUpdate_set_signature(uint64_t this_ptr, int8_tArray val) {
32458         LDKChannelUpdate this_ptr_conv;
32459         this_ptr_conv.inner = untag_ptr(this_ptr);
32460         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32462         this_ptr_conv.is_owned = false;
32463         LDKSignature val_ref;
32464         CHECK(val->arr_len == 64);
32465         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
32466         ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
32467 }
32468
32469 uint64_t  __attribute__((export_name("TS_ChannelUpdate_get_contents"))) TS_ChannelUpdate_get_contents(uint64_t this_ptr) {
32470         LDKChannelUpdate this_ptr_conv;
32471         this_ptr_conv.inner = untag_ptr(this_ptr);
32472         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32474         this_ptr_conv.is_owned = false;
32475         LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
32476         uint64_t ret_ref = 0;
32477         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32478         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32479         return ret_ref;
32480 }
32481
32482 void  __attribute__((export_name("TS_ChannelUpdate_set_contents"))) TS_ChannelUpdate_set_contents(uint64_t this_ptr, uint64_t val) {
32483         LDKChannelUpdate this_ptr_conv;
32484         this_ptr_conv.inner = untag_ptr(this_ptr);
32485         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32487         this_ptr_conv.is_owned = false;
32488         LDKUnsignedChannelUpdate val_conv;
32489         val_conv.inner = untag_ptr(val);
32490         val_conv.is_owned = ptr_is_owned(val);
32491         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32492         val_conv = UnsignedChannelUpdate_clone(&val_conv);
32493         ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
32494 }
32495
32496 uint64_t  __attribute__((export_name("TS_ChannelUpdate_new"))) TS_ChannelUpdate_new(int8_tArray signature_arg, uint64_t contents_arg) {
32497         LDKSignature signature_arg_ref;
32498         CHECK(signature_arg->arr_len == 64);
32499         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
32500         LDKUnsignedChannelUpdate contents_arg_conv;
32501         contents_arg_conv.inner = untag_ptr(contents_arg);
32502         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
32503         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
32504         contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
32505         LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
32506         uint64_t ret_ref = 0;
32507         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32508         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32509         return ret_ref;
32510 }
32511
32512 static inline uint64_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
32513         LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
32514         uint64_t ret_ref = 0;
32515         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32516         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32517         return ret_ref;
32518 }
32519 int64_t  __attribute__((export_name("TS_ChannelUpdate_clone_ptr"))) TS_ChannelUpdate_clone_ptr(uint64_t arg) {
32520         LDKChannelUpdate arg_conv;
32521         arg_conv.inner = untag_ptr(arg);
32522         arg_conv.is_owned = ptr_is_owned(arg);
32523         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32524         arg_conv.is_owned = false;
32525         int64_t ret_conv = ChannelUpdate_clone_ptr(&arg_conv);
32526         return ret_conv;
32527 }
32528
32529 uint64_t  __attribute__((export_name("TS_ChannelUpdate_clone"))) TS_ChannelUpdate_clone(uint64_t orig) {
32530         LDKChannelUpdate orig_conv;
32531         orig_conv.inner = untag_ptr(orig);
32532         orig_conv.is_owned = ptr_is_owned(orig);
32533         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32534         orig_conv.is_owned = false;
32535         LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
32536         uint64_t ret_ref = 0;
32537         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32538         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32539         return ret_ref;
32540 }
32541
32542 void  __attribute__((export_name("TS_QueryChannelRange_free"))) TS_QueryChannelRange_free(uint64_t this_obj) {
32543         LDKQueryChannelRange this_obj_conv;
32544         this_obj_conv.inner = untag_ptr(this_obj);
32545         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32547         QueryChannelRange_free(this_obj_conv);
32548 }
32549
32550 int8_tArray  __attribute__((export_name("TS_QueryChannelRange_get_chain_hash"))) TS_QueryChannelRange_get_chain_hash(uint64_t this_ptr) {
32551         LDKQueryChannelRange this_ptr_conv;
32552         this_ptr_conv.inner = untag_ptr(this_ptr);
32553         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32555         this_ptr_conv.is_owned = false;
32556         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32557         memcpy(ret_arr->elems, *QueryChannelRange_get_chain_hash(&this_ptr_conv), 32);
32558         return ret_arr;
32559 }
32560
32561 void  __attribute__((export_name("TS_QueryChannelRange_set_chain_hash"))) TS_QueryChannelRange_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
32562         LDKQueryChannelRange this_ptr_conv;
32563         this_ptr_conv.inner = untag_ptr(this_ptr);
32564         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32565         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32566         this_ptr_conv.is_owned = false;
32567         LDKThirtyTwoBytes val_ref;
32568         CHECK(val->arr_len == 32);
32569         memcpy(val_ref.data, val->elems, 32); FREE(val);
32570         QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
32571 }
32572
32573 int32_t  __attribute__((export_name("TS_QueryChannelRange_get_first_blocknum"))) TS_QueryChannelRange_get_first_blocknum(uint64_t this_ptr) {
32574         LDKQueryChannelRange this_ptr_conv;
32575         this_ptr_conv.inner = untag_ptr(this_ptr);
32576         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32578         this_ptr_conv.is_owned = false;
32579         int32_t ret_conv = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
32580         return ret_conv;
32581 }
32582
32583 void  __attribute__((export_name("TS_QueryChannelRange_set_first_blocknum"))) TS_QueryChannelRange_set_first_blocknum(uint64_t this_ptr, int32_t val) {
32584         LDKQueryChannelRange this_ptr_conv;
32585         this_ptr_conv.inner = untag_ptr(this_ptr);
32586         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32588         this_ptr_conv.is_owned = false;
32589         QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
32590 }
32591
32592 int32_t  __attribute__((export_name("TS_QueryChannelRange_get_number_of_blocks"))) TS_QueryChannelRange_get_number_of_blocks(uint64_t this_ptr) {
32593         LDKQueryChannelRange this_ptr_conv;
32594         this_ptr_conv.inner = untag_ptr(this_ptr);
32595         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32597         this_ptr_conv.is_owned = false;
32598         int32_t ret_conv = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
32599         return ret_conv;
32600 }
32601
32602 void  __attribute__((export_name("TS_QueryChannelRange_set_number_of_blocks"))) TS_QueryChannelRange_set_number_of_blocks(uint64_t this_ptr, int32_t val) {
32603         LDKQueryChannelRange this_ptr_conv;
32604         this_ptr_conv.inner = untag_ptr(this_ptr);
32605         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32607         this_ptr_conv.is_owned = false;
32608         QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
32609 }
32610
32611 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) {
32612         LDKThirtyTwoBytes chain_hash_arg_ref;
32613         CHECK(chain_hash_arg->arr_len == 32);
32614         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
32615         LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
32616         uint64_t ret_ref = 0;
32617         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32618         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32619         return ret_ref;
32620 }
32621
32622 static inline uint64_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
32623         LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
32624         uint64_t ret_ref = 0;
32625         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32626         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32627         return ret_ref;
32628 }
32629 int64_t  __attribute__((export_name("TS_QueryChannelRange_clone_ptr"))) TS_QueryChannelRange_clone_ptr(uint64_t arg) {
32630         LDKQueryChannelRange arg_conv;
32631         arg_conv.inner = untag_ptr(arg);
32632         arg_conv.is_owned = ptr_is_owned(arg);
32633         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32634         arg_conv.is_owned = false;
32635         int64_t ret_conv = QueryChannelRange_clone_ptr(&arg_conv);
32636         return ret_conv;
32637 }
32638
32639 uint64_t  __attribute__((export_name("TS_QueryChannelRange_clone"))) TS_QueryChannelRange_clone(uint64_t orig) {
32640         LDKQueryChannelRange orig_conv;
32641         orig_conv.inner = untag_ptr(orig);
32642         orig_conv.is_owned = ptr_is_owned(orig);
32643         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32644         orig_conv.is_owned = false;
32645         LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
32646         uint64_t ret_ref = 0;
32647         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32648         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32649         return ret_ref;
32650 }
32651
32652 void  __attribute__((export_name("TS_ReplyChannelRange_free"))) TS_ReplyChannelRange_free(uint64_t this_obj) {
32653         LDKReplyChannelRange this_obj_conv;
32654         this_obj_conv.inner = untag_ptr(this_obj);
32655         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32657         ReplyChannelRange_free(this_obj_conv);
32658 }
32659
32660 int8_tArray  __attribute__((export_name("TS_ReplyChannelRange_get_chain_hash"))) TS_ReplyChannelRange_get_chain_hash(uint64_t this_ptr) {
32661         LDKReplyChannelRange this_ptr_conv;
32662         this_ptr_conv.inner = untag_ptr(this_ptr);
32663         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32665         this_ptr_conv.is_owned = false;
32666         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32667         memcpy(ret_arr->elems, *ReplyChannelRange_get_chain_hash(&this_ptr_conv), 32);
32668         return ret_arr;
32669 }
32670
32671 void  __attribute__((export_name("TS_ReplyChannelRange_set_chain_hash"))) TS_ReplyChannelRange_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
32672         LDKReplyChannelRange this_ptr_conv;
32673         this_ptr_conv.inner = untag_ptr(this_ptr);
32674         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32676         this_ptr_conv.is_owned = false;
32677         LDKThirtyTwoBytes val_ref;
32678         CHECK(val->arr_len == 32);
32679         memcpy(val_ref.data, val->elems, 32); FREE(val);
32680         ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
32681 }
32682
32683 int32_t  __attribute__((export_name("TS_ReplyChannelRange_get_first_blocknum"))) TS_ReplyChannelRange_get_first_blocknum(uint64_t this_ptr) {
32684         LDKReplyChannelRange this_ptr_conv;
32685         this_ptr_conv.inner = untag_ptr(this_ptr);
32686         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32688         this_ptr_conv.is_owned = false;
32689         int32_t ret_conv = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
32690         return ret_conv;
32691 }
32692
32693 void  __attribute__((export_name("TS_ReplyChannelRange_set_first_blocknum"))) TS_ReplyChannelRange_set_first_blocknum(uint64_t this_ptr, int32_t val) {
32694         LDKReplyChannelRange this_ptr_conv;
32695         this_ptr_conv.inner = untag_ptr(this_ptr);
32696         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32698         this_ptr_conv.is_owned = false;
32699         ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
32700 }
32701
32702 int32_t  __attribute__((export_name("TS_ReplyChannelRange_get_number_of_blocks"))) TS_ReplyChannelRange_get_number_of_blocks(uint64_t this_ptr) {
32703         LDKReplyChannelRange this_ptr_conv;
32704         this_ptr_conv.inner = untag_ptr(this_ptr);
32705         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32706         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32707         this_ptr_conv.is_owned = false;
32708         int32_t ret_conv = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
32709         return ret_conv;
32710 }
32711
32712 void  __attribute__((export_name("TS_ReplyChannelRange_set_number_of_blocks"))) TS_ReplyChannelRange_set_number_of_blocks(uint64_t this_ptr, int32_t val) {
32713         LDKReplyChannelRange this_ptr_conv;
32714         this_ptr_conv.inner = untag_ptr(this_ptr);
32715         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32717         this_ptr_conv.is_owned = false;
32718         ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
32719 }
32720
32721 jboolean  __attribute__((export_name("TS_ReplyChannelRange_get_sync_complete"))) TS_ReplyChannelRange_get_sync_complete(uint64_t this_ptr) {
32722         LDKReplyChannelRange this_ptr_conv;
32723         this_ptr_conv.inner = untag_ptr(this_ptr);
32724         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32726         this_ptr_conv.is_owned = false;
32727         jboolean ret_conv = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
32728         return ret_conv;
32729 }
32730
32731 void  __attribute__((export_name("TS_ReplyChannelRange_set_sync_complete"))) TS_ReplyChannelRange_set_sync_complete(uint64_t this_ptr, jboolean val) {
32732         LDKReplyChannelRange this_ptr_conv;
32733         this_ptr_conv.inner = untag_ptr(this_ptr);
32734         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32736         this_ptr_conv.is_owned = false;
32737         ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
32738 }
32739
32740 int64_tArray  __attribute__((export_name("TS_ReplyChannelRange_get_short_channel_ids"))) TS_ReplyChannelRange_get_short_channel_ids(uint64_t this_ptr) {
32741         LDKReplyChannelRange this_ptr_conv;
32742         this_ptr_conv.inner = untag_ptr(this_ptr);
32743         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32744         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32745         this_ptr_conv.is_owned = false;
32746         LDKCVec_u64Z ret_var = ReplyChannelRange_get_short_channel_ids(&this_ptr_conv);
32747         int64_tArray ret_arr = NULL;
32748         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
32749         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
32750         for (size_t i = 0; i < ret_var.datalen; i++) {
32751                 int64_t ret_conv_8_conv = ret_var.data[i];
32752                 ret_arr_ptr[i] = ret_conv_8_conv;
32753         }
32754         
32755         FREE(ret_var.data);
32756         return ret_arr;
32757 }
32758
32759 void  __attribute__((export_name("TS_ReplyChannelRange_set_short_channel_ids"))) TS_ReplyChannelRange_set_short_channel_ids(uint64_t this_ptr, int64_tArray val) {
32760         LDKReplyChannelRange this_ptr_conv;
32761         this_ptr_conv.inner = untag_ptr(this_ptr);
32762         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32764         this_ptr_conv.is_owned = false;
32765         LDKCVec_u64Z val_constr;
32766         val_constr.datalen = val->arr_len;
32767         if (val_constr.datalen > 0)
32768                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
32769         else
32770                 val_constr.data = NULL;
32771         int64_t* val_vals = val->elems;
32772         for (size_t i = 0; i < val_constr.datalen; i++) {
32773                 int64_t val_conv_8 = val_vals[i];
32774                 val_constr.data[i] = val_conv_8;
32775         }
32776         FREE(val);
32777         ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
32778 }
32779
32780 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) {
32781         LDKThirtyTwoBytes chain_hash_arg_ref;
32782         CHECK(chain_hash_arg->arr_len == 32);
32783         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
32784         LDKCVec_u64Z short_channel_ids_arg_constr;
32785         short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
32786         if (short_channel_ids_arg_constr.datalen > 0)
32787                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
32788         else
32789                 short_channel_ids_arg_constr.data = NULL;
32790         int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
32791         for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
32792                 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
32793                 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
32794         }
32795         FREE(short_channel_ids_arg);
32796         LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
32797         uint64_t ret_ref = 0;
32798         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32799         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32800         return ret_ref;
32801 }
32802
32803 static inline uint64_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
32804         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
32805         uint64_t ret_ref = 0;
32806         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32807         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32808         return ret_ref;
32809 }
32810 int64_t  __attribute__((export_name("TS_ReplyChannelRange_clone_ptr"))) TS_ReplyChannelRange_clone_ptr(uint64_t arg) {
32811         LDKReplyChannelRange arg_conv;
32812         arg_conv.inner = untag_ptr(arg);
32813         arg_conv.is_owned = ptr_is_owned(arg);
32814         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32815         arg_conv.is_owned = false;
32816         int64_t ret_conv = ReplyChannelRange_clone_ptr(&arg_conv);
32817         return ret_conv;
32818 }
32819
32820 uint64_t  __attribute__((export_name("TS_ReplyChannelRange_clone"))) TS_ReplyChannelRange_clone(uint64_t orig) {
32821         LDKReplyChannelRange orig_conv;
32822         orig_conv.inner = untag_ptr(orig);
32823         orig_conv.is_owned = ptr_is_owned(orig);
32824         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32825         orig_conv.is_owned = false;
32826         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
32827         uint64_t ret_ref = 0;
32828         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32829         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32830         return ret_ref;
32831 }
32832
32833 void  __attribute__((export_name("TS_QueryShortChannelIds_free"))) TS_QueryShortChannelIds_free(uint64_t this_obj) {
32834         LDKQueryShortChannelIds this_obj_conv;
32835         this_obj_conv.inner = untag_ptr(this_obj);
32836         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32838         QueryShortChannelIds_free(this_obj_conv);
32839 }
32840
32841 int8_tArray  __attribute__((export_name("TS_QueryShortChannelIds_get_chain_hash"))) TS_QueryShortChannelIds_get_chain_hash(uint64_t this_ptr) {
32842         LDKQueryShortChannelIds this_ptr_conv;
32843         this_ptr_conv.inner = untag_ptr(this_ptr);
32844         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32846         this_ptr_conv.is_owned = false;
32847         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32848         memcpy(ret_arr->elems, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv), 32);
32849         return ret_arr;
32850 }
32851
32852 void  __attribute__((export_name("TS_QueryShortChannelIds_set_chain_hash"))) TS_QueryShortChannelIds_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
32853         LDKQueryShortChannelIds this_ptr_conv;
32854         this_ptr_conv.inner = untag_ptr(this_ptr);
32855         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32857         this_ptr_conv.is_owned = false;
32858         LDKThirtyTwoBytes val_ref;
32859         CHECK(val->arr_len == 32);
32860         memcpy(val_ref.data, val->elems, 32); FREE(val);
32861         QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
32862 }
32863
32864 int64_tArray  __attribute__((export_name("TS_QueryShortChannelIds_get_short_channel_ids"))) TS_QueryShortChannelIds_get_short_channel_ids(uint64_t this_ptr) {
32865         LDKQueryShortChannelIds this_ptr_conv;
32866         this_ptr_conv.inner = untag_ptr(this_ptr);
32867         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32869         this_ptr_conv.is_owned = false;
32870         LDKCVec_u64Z ret_var = QueryShortChannelIds_get_short_channel_ids(&this_ptr_conv);
32871         int64_tArray ret_arr = NULL;
32872         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
32873         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
32874         for (size_t i = 0; i < ret_var.datalen; i++) {
32875                 int64_t ret_conv_8_conv = ret_var.data[i];
32876                 ret_arr_ptr[i] = ret_conv_8_conv;
32877         }
32878         
32879         FREE(ret_var.data);
32880         return ret_arr;
32881 }
32882
32883 void  __attribute__((export_name("TS_QueryShortChannelIds_set_short_channel_ids"))) TS_QueryShortChannelIds_set_short_channel_ids(uint64_t this_ptr, int64_tArray val) {
32884         LDKQueryShortChannelIds this_ptr_conv;
32885         this_ptr_conv.inner = untag_ptr(this_ptr);
32886         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32888         this_ptr_conv.is_owned = false;
32889         LDKCVec_u64Z val_constr;
32890         val_constr.datalen = val->arr_len;
32891         if (val_constr.datalen > 0)
32892                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
32893         else
32894                 val_constr.data = NULL;
32895         int64_t* val_vals = val->elems;
32896         for (size_t i = 0; i < val_constr.datalen; i++) {
32897                 int64_t val_conv_8 = val_vals[i];
32898                 val_constr.data[i] = val_conv_8;
32899         }
32900         FREE(val);
32901         QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
32902 }
32903
32904 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_new"))) TS_QueryShortChannelIds_new(int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
32905         LDKThirtyTwoBytes chain_hash_arg_ref;
32906         CHECK(chain_hash_arg->arr_len == 32);
32907         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
32908         LDKCVec_u64Z short_channel_ids_arg_constr;
32909         short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
32910         if (short_channel_ids_arg_constr.datalen > 0)
32911                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
32912         else
32913                 short_channel_ids_arg_constr.data = NULL;
32914         int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
32915         for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
32916                 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
32917                 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
32918         }
32919         FREE(short_channel_ids_arg);
32920         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
32921         uint64_t ret_ref = 0;
32922         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32923         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32924         return ret_ref;
32925 }
32926
32927 static inline uint64_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
32928         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
32929         uint64_t ret_ref = 0;
32930         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32931         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32932         return ret_ref;
32933 }
32934 int64_t  __attribute__((export_name("TS_QueryShortChannelIds_clone_ptr"))) TS_QueryShortChannelIds_clone_ptr(uint64_t arg) {
32935         LDKQueryShortChannelIds arg_conv;
32936         arg_conv.inner = untag_ptr(arg);
32937         arg_conv.is_owned = ptr_is_owned(arg);
32938         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32939         arg_conv.is_owned = false;
32940         int64_t ret_conv = QueryShortChannelIds_clone_ptr(&arg_conv);
32941         return ret_conv;
32942 }
32943
32944 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_clone"))) TS_QueryShortChannelIds_clone(uint64_t orig) {
32945         LDKQueryShortChannelIds orig_conv;
32946         orig_conv.inner = untag_ptr(orig);
32947         orig_conv.is_owned = ptr_is_owned(orig);
32948         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32949         orig_conv.is_owned = false;
32950         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
32951         uint64_t ret_ref = 0;
32952         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32953         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32954         return ret_ref;
32955 }
32956
32957 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_free"))) TS_ReplyShortChannelIdsEnd_free(uint64_t this_obj) {
32958         LDKReplyShortChannelIdsEnd this_obj_conv;
32959         this_obj_conv.inner = untag_ptr(this_obj);
32960         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32962         ReplyShortChannelIdsEnd_free(this_obj_conv);
32963 }
32964
32965 int8_tArray  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_chain_hash"))) TS_ReplyShortChannelIdsEnd_get_chain_hash(uint64_t this_ptr) {
32966         LDKReplyShortChannelIdsEnd this_ptr_conv;
32967         this_ptr_conv.inner = untag_ptr(this_ptr);
32968         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32970         this_ptr_conv.is_owned = false;
32971         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32972         memcpy(ret_arr->elems, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv), 32);
32973         return ret_arr;
32974 }
32975
32976 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_chain_hash"))) TS_ReplyShortChannelIdsEnd_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
32977         LDKReplyShortChannelIdsEnd this_ptr_conv;
32978         this_ptr_conv.inner = untag_ptr(this_ptr);
32979         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32981         this_ptr_conv.is_owned = false;
32982         LDKThirtyTwoBytes val_ref;
32983         CHECK(val->arr_len == 32);
32984         memcpy(val_ref.data, val->elems, 32); FREE(val);
32985         ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
32986 }
32987
32988 jboolean  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_full_information"))) TS_ReplyShortChannelIdsEnd_get_full_information(uint64_t this_ptr) {
32989         LDKReplyShortChannelIdsEnd this_ptr_conv;
32990         this_ptr_conv.inner = untag_ptr(this_ptr);
32991         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32993         this_ptr_conv.is_owned = false;
32994         jboolean ret_conv = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
32995         return ret_conv;
32996 }
32997
32998 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_full_information"))) TS_ReplyShortChannelIdsEnd_set_full_information(uint64_t this_ptr, jboolean val) {
32999         LDKReplyShortChannelIdsEnd this_ptr_conv;
33000         this_ptr_conv.inner = untag_ptr(this_ptr);
33001         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33003         this_ptr_conv.is_owned = false;
33004         ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
33005 }
33006
33007 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_new"))) TS_ReplyShortChannelIdsEnd_new(int8_tArray chain_hash_arg, jboolean full_information_arg) {
33008         LDKThirtyTwoBytes chain_hash_arg_ref;
33009         CHECK(chain_hash_arg->arr_len == 32);
33010         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
33011         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
33012         uint64_t ret_ref = 0;
33013         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33014         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33015         return ret_ref;
33016 }
33017
33018 static inline uint64_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
33019         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
33020         uint64_t ret_ref = 0;
33021         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33022         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33023         return ret_ref;
33024 }
33025 int64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone_ptr"))) TS_ReplyShortChannelIdsEnd_clone_ptr(uint64_t arg) {
33026         LDKReplyShortChannelIdsEnd arg_conv;
33027         arg_conv.inner = untag_ptr(arg);
33028         arg_conv.is_owned = ptr_is_owned(arg);
33029         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33030         arg_conv.is_owned = false;
33031         int64_t ret_conv = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
33032         return ret_conv;
33033 }
33034
33035 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone"))) TS_ReplyShortChannelIdsEnd_clone(uint64_t orig) {
33036         LDKReplyShortChannelIdsEnd orig_conv;
33037         orig_conv.inner = untag_ptr(orig);
33038         orig_conv.is_owned = ptr_is_owned(orig);
33039         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33040         orig_conv.is_owned = false;
33041         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
33042         uint64_t ret_ref = 0;
33043         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33044         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33045         return ret_ref;
33046 }
33047
33048 void  __attribute__((export_name("TS_GossipTimestampFilter_free"))) TS_GossipTimestampFilter_free(uint64_t this_obj) {
33049         LDKGossipTimestampFilter this_obj_conv;
33050         this_obj_conv.inner = untag_ptr(this_obj);
33051         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33053         GossipTimestampFilter_free(this_obj_conv);
33054 }
33055
33056 int8_tArray  __attribute__((export_name("TS_GossipTimestampFilter_get_chain_hash"))) TS_GossipTimestampFilter_get_chain_hash(uint64_t this_ptr) {
33057         LDKGossipTimestampFilter this_ptr_conv;
33058         this_ptr_conv.inner = untag_ptr(this_ptr);
33059         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33061         this_ptr_conv.is_owned = false;
33062         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33063         memcpy(ret_arr->elems, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv), 32);
33064         return ret_arr;
33065 }
33066
33067 void  __attribute__((export_name("TS_GossipTimestampFilter_set_chain_hash"))) TS_GossipTimestampFilter_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
33068         LDKGossipTimestampFilter this_ptr_conv;
33069         this_ptr_conv.inner = untag_ptr(this_ptr);
33070         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33071         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33072         this_ptr_conv.is_owned = false;
33073         LDKThirtyTwoBytes val_ref;
33074         CHECK(val->arr_len == 32);
33075         memcpy(val_ref.data, val->elems, 32); FREE(val);
33076         GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
33077 }
33078
33079 int32_t  __attribute__((export_name("TS_GossipTimestampFilter_get_first_timestamp"))) TS_GossipTimestampFilter_get_first_timestamp(uint64_t this_ptr) {
33080         LDKGossipTimestampFilter this_ptr_conv;
33081         this_ptr_conv.inner = untag_ptr(this_ptr);
33082         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33084         this_ptr_conv.is_owned = false;
33085         int32_t ret_conv = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
33086         return ret_conv;
33087 }
33088
33089 void  __attribute__((export_name("TS_GossipTimestampFilter_set_first_timestamp"))) TS_GossipTimestampFilter_set_first_timestamp(uint64_t this_ptr, int32_t val) {
33090         LDKGossipTimestampFilter this_ptr_conv;
33091         this_ptr_conv.inner = untag_ptr(this_ptr);
33092         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33093         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33094         this_ptr_conv.is_owned = false;
33095         GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
33096 }
33097
33098 int32_t  __attribute__((export_name("TS_GossipTimestampFilter_get_timestamp_range"))) TS_GossipTimestampFilter_get_timestamp_range(uint64_t this_ptr) {
33099         LDKGossipTimestampFilter this_ptr_conv;
33100         this_ptr_conv.inner = untag_ptr(this_ptr);
33101         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33103         this_ptr_conv.is_owned = false;
33104         int32_t ret_conv = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
33105         return ret_conv;
33106 }
33107
33108 void  __attribute__((export_name("TS_GossipTimestampFilter_set_timestamp_range"))) TS_GossipTimestampFilter_set_timestamp_range(uint64_t this_ptr, int32_t val) {
33109         LDKGossipTimestampFilter this_ptr_conv;
33110         this_ptr_conv.inner = untag_ptr(this_ptr);
33111         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33113         this_ptr_conv.is_owned = false;
33114         GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
33115 }
33116
33117 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) {
33118         LDKThirtyTwoBytes chain_hash_arg_ref;
33119         CHECK(chain_hash_arg->arr_len == 32);
33120         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
33121         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
33122         uint64_t ret_ref = 0;
33123         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33124         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33125         return ret_ref;
33126 }
33127
33128 static inline uint64_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
33129         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
33130         uint64_t ret_ref = 0;
33131         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33132         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33133         return ret_ref;
33134 }
33135 int64_t  __attribute__((export_name("TS_GossipTimestampFilter_clone_ptr"))) TS_GossipTimestampFilter_clone_ptr(uint64_t arg) {
33136         LDKGossipTimestampFilter arg_conv;
33137         arg_conv.inner = untag_ptr(arg);
33138         arg_conv.is_owned = ptr_is_owned(arg);
33139         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33140         arg_conv.is_owned = false;
33141         int64_t ret_conv = GossipTimestampFilter_clone_ptr(&arg_conv);
33142         return ret_conv;
33143 }
33144
33145 uint64_t  __attribute__((export_name("TS_GossipTimestampFilter_clone"))) TS_GossipTimestampFilter_clone(uint64_t orig) {
33146         LDKGossipTimestampFilter orig_conv;
33147         orig_conv.inner = untag_ptr(orig);
33148         orig_conv.is_owned = ptr_is_owned(orig);
33149         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33150         orig_conv.is_owned = false;
33151         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
33152         uint64_t ret_ref = 0;
33153         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33154         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33155         return ret_ref;
33156 }
33157
33158 void  __attribute__((export_name("TS_ErrorAction_free"))) TS_ErrorAction_free(uint64_t this_ptr) {
33159         if (!ptr_is_owned(this_ptr)) return;
33160         void* this_ptr_ptr = untag_ptr(this_ptr);
33161         CHECK_ACCESS(this_ptr_ptr);
33162         LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
33163         FREE(untag_ptr(this_ptr));
33164         ErrorAction_free(this_ptr_conv);
33165 }
33166
33167 static inline uint64_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
33168         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
33169         *ret_copy = ErrorAction_clone(arg);
33170         uint64_t ret_ref = tag_ptr(ret_copy, true);
33171         return ret_ref;
33172 }
33173 int64_t  __attribute__((export_name("TS_ErrorAction_clone_ptr"))) TS_ErrorAction_clone_ptr(uint64_t arg) {
33174         LDKErrorAction* arg_conv = (LDKErrorAction*)untag_ptr(arg);
33175         int64_t ret_conv = ErrorAction_clone_ptr(arg_conv);
33176         return ret_conv;
33177 }
33178
33179 uint64_t  __attribute__((export_name("TS_ErrorAction_clone"))) TS_ErrorAction_clone(uint64_t orig) {
33180         LDKErrorAction* orig_conv = (LDKErrorAction*)untag_ptr(orig);
33181         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
33182         *ret_copy = ErrorAction_clone(orig_conv);
33183         uint64_t ret_ref = tag_ptr(ret_copy, true);
33184         return ret_ref;
33185 }
33186
33187 uint64_t  __attribute__((export_name("TS_ErrorAction_disconnect_peer"))) TS_ErrorAction_disconnect_peer(uint64_t msg) {
33188         LDKErrorMessage msg_conv;
33189         msg_conv.inner = untag_ptr(msg);
33190         msg_conv.is_owned = ptr_is_owned(msg);
33191         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
33192         msg_conv = ErrorMessage_clone(&msg_conv);
33193         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
33194         *ret_copy = ErrorAction_disconnect_peer(msg_conv);
33195         uint64_t ret_ref = tag_ptr(ret_copy, true);
33196         return ret_ref;
33197 }
33198
33199 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_error"))) TS_ErrorAction_ignore_error() {
33200         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
33201         *ret_copy = ErrorAction_ignore_error();
33202         uint64_t ret_ref = tag_ptr(ret_copy, true);
33203         return ret_ref;
33204 }
33205
33206 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_and_log"))) TS_ErrorAction_ignore_and_log(uint32_t a) {
33207         LDKLevel a_conv = LDKLevel_from_js(a);
33208         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
33209         *ret_copy = ErrorAction_ignore_and_log(a_conv);
33210         uint64_t ret_ref = tag_ptr(ret_copy, true);
33211         return ret_ref;
33212 }
33213
33214 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_duplicate_gossip"))) TS_ErrorAction_ignore_duplicate_gossip() {
33215         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
33216         *ret_copy = ErrorAction_ignore_duplicate_gossip();
33217         uint64_t ret_ref = tag_ptr(ret_copy, true);
33218         return ret_ref;
33219 }
33220
33221 uint64_t  __attribute__((export_name("TS_ErrorAction_send_error_message"))) TS_ErrorAction_send_error_message(uint64_t msg) {
33222         LDKErrorMessage msg_conv;
33223         msg_conv.inner = untag_ptr(msg);
33224         msg_conv.is_owned = ptr_is_owned(msg);
33225         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
33226         msg_conv = ErrorMessage_clone(&msg_conv);
33227         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
33228         *ret_copy = ErrorAction_send_error_message(msg_conv);
33229         uint64_t ret_ref = tag_ptr(ret_copy, true);
33230         return ret_ref;
33231 }
33232
33233 uint64_t  __attribute__((export_name("TS_ErrorAction_send_warning_message"))) TS_ErrorAction_send_warning_message(uint64_t msg, uint32_t log_level) {
33234         LDKWarningMessage msg_conv;
33235         msg_conv.inner = untag_ptr(msg);
33236         msg_conv.is_owned = ptr_is_owned(msg);
33237         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
33238         msg_conv = WarningMessage_clone(&msg_conv);
33239         LDKLevel log_level_conv = LDKLevel_from_js(log_level);
33240         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
33241         *ret_copy = ErrorAction_send_warning_message(msg_conv, log_level_conv);
33242         uint64_t ret_ref = tag_ptr(ret_copy, true);
33243         return ret_ref;
33244 }
33245
33246 void  __attribute__((export_name("TS_LightningError_free"))) TS_LightningError_free(uint64_t this_obj) {
33247         LDKLightningError this_obj_conv;
33248         this_obj_conv.inner = untag_ptr(this_obj);
33249         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33251         LightningError_free(this_obj_conv);
33252 }
33253
33254 jstring  __attribute__((export_name("TS_LightningError_get_err"))) TS_LightningError_get_err(uint64_t this_ptr) {
33255         LDKLightningError this_ptr_conv;
33256         this_ptr_conv.inner = untag_ptr(this_ptr);
33257         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33259         this_ptr_conv.is_owned = false;
33260         LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
33261         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
33262         Str_free(ret_str);
33263         return ret_conv;
33264 }
33265
33266 void  __attribute__((export_name("TS_LightningError_set_err"))) TS_LightningError_set_err(uint64_t this_ptr, jstring val) {
33267         LDKLightningError this_ptr_conv;
33268         this_ptr_conv.inner = untag_ptr(this_ptr);
33269         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33271         this_ptr_conv.is_owned = false;
33272         LDKStr val_conv = str_ref_to_owned_c(val);
33273         LightningError_set_err(&this_ptr_conv, val_conv);
33274 }
33275
33276 uint64_t  __attribute__((export_name("TS_LightningError_get_action"))) TS_LightningError_get_action(uint64_t this_ptr) {
33277         LDKLightningError this_ptr_conv;
33278         this_ptr_conv.inner = untag_ptr(this_ptr);
33279         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33281         this_ptr_conv.is_owned = false;
33282         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
33283         *ret_copy = LightningError_get_action(&this_ptr_conv);
33284         uint64_t ret_ref = tag_ptr(ret_copy, true);
33285         return ret_ref;
33286 }
33287
33288 void  __attribute__((export_name("TS_LightningError_set_action"))) TS_LightningError_set_action(uint64_t this_ptr, uint64_t val) {
33289         LDKLightningError this_ptr_conv;
33290         this_ptr_conv.inner = untag_ptr(this_ptr);
33291         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33293         this_ptr_conv.is_owned = false;
33294         void* val_ptr = untag_ptr(val);
33295         CHECK_ACCESS(val_ptr);
33296         LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
33297         val_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(val));
33298         LightningError_set_action(&this_ptr_conv, val_conv);
33299 }
33300
33301 uint64_t  __attribute__((export_name("TS_LightningError_new"))) TS_LightningError_new(jstring err_arg, uint64_t action_arg) {
33302         LDKStr err_arg_conv = str_ref_to_owned_c(err_arg);
33303         void* action_arg_ptr = untag_ptr(action_arg);
33304         CHECK_ACCESS(action_arg_ptr);
33305         LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
33306         action_arg_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action_arg));
33307         LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
33308         uint64_t ret_ref = 0;
33309         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33310         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33311         return ret_ref;
33312 }
33313
33314 static inline uint64_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
33315         LDKLightningError ret_var = LightningError_clone(arg);
33316         uint64_t ret_ref = 0;
33317         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33318         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33319         return ret_ref;
33320 }
33321 int64_t  __attribute__((export_name("TS_LightningError_clone_ptr"))) TS_LightningError_clone_ptr(uint64_t arg) {
33322         LDKLightningError arg_conv;
33323         arg_conv.inner = untag_ptr(arg);
33324         arg_conv.is_owned = ptr_is_owned(arg);
33325         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33326         arg_conv.is_owned = false;
33327         int64_t ret_conv = LightningError_clone_ptr(&arg_conv);
33328         return ret_conv;
33329 }
33330
33331 uint64_t  __attribute__((export_name("TS_LightningError_clone"))) TS_LightningError_clone(uint64_t orig) {
33332         LDKLightningError orig_conv;
33333         orig_conv.inner = untag_ptr(orig);
33334         orig_conv.is_owned = ptr_is_owned(orig);
33335         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33336         orig_conv.is_owned = false;
33337         LDKLightningError ret_var = LightningError_clone(&orig_conv);
33338         uint64_t ret_ref = 0;
33339         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33340         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33341         return ret_ref;
33342 }
33343
33344 void  __attribute__((export_name("TS_CommitmentUpdate_free"))) TS_CommitmentUpdate_free(uint64_t this_obj) {
33345         LDKCommitmentUpdate this_obj_conv;
33346         this_obj_conv.inner = untag_ptr(this_obj);
33347         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33349         CommitmentUpdate_free(this_obj_conv);
33350 }
33351
33352 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_add_htlcs"))) TS_CommitmentUpdate_get_update_add_htlcs(uint64_t this_ptr) {
33353         LDKCommitmentUpdate this_ptr_conv;
33354         this_ptr_conv.inner = untag_ptr(this_ptr);
33355         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33357         this_ptr_conv.is_owned = false;
33358         LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
33359         uint64_tArray ret_arr = NULL;
33360         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
33361         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
33362         for (size_t p = 0; p < ret_var.datalen; p++) {
33363                 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
33364                 uint64_t ret_conv_15_ref = 0;
33365                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
33366                 ret_conv_15_ref = tag_ptr(ret_conv_15_var.inner, ret_conv_15_var.is_owned);
33367                 ret_arr_ptr[p] = ret_conv_15_ref;
33368         }
33369         
33370         FREE(ret_var.data);
33371         return ret_arr;
33372 }
33373
33374 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_add_htlcs"))) TS_CommitmentUpdate_set_update_add_htlcs(uint64_t this_ptr, uint64_tArray val) {
33375         LDKCommitmentUpdate this_ptr_conv;
33376         this_ptr_conv.inner = untag_ptr(this_ptr);
33377         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33379         this_ptr_conv.is_owned = false;
33380         LDKCVec_UpdateAddHTLCZ val_constr;
33381         val_constr.datalen = val->arr_len;
33382         if (val_constr.datalen > 0)
33383                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
33384         else
33385                 val_constr.data = NULL;
33386         uint64_t* val_vals = val->elems;
33387         for (size_t p = 0; p < val_constr.datalen; p++) {
33388                 uint64_t val_conv_15 = val_vals[p];
33389                 LDKUpdateAddHTLC val_conv_15_conv;
33390                 val_conv_15_conv.inner = untag_ptr(val_conv_15);
33391                 val_conv_15_conv.is_owned = ptr_is_owned(val_conv_15);
33392                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
33393                 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
33394                 val_constr.data[p] = val_conv_15_conv;
33395         }
33396         FREE(val);
33397         CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
33398 }
33399
33400 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fulfill_htlcs"))) TS_CommitmentUpdate_get_update_fulfill_htlcs(uint64_t this_ptr) {
33401         LDKCommitmentUpdate this_ptr_conv;
33402         this_ptr_conv.inner = untag_ptr(this_ptr);
33403         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33405         this_ptr_conv.is_owned = false;
33406         LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
33407         uint64_tArray ret_arr = NULL;
33408         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
33409         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
33410         for (size_t t = 0; t < ret_var.datalen; t++) {
33411                 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
33412                 uint64_t ret_conv_19_ref = 0;
33413                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
33414                 ret_conv_19_ref = tag_ptr(ret_conv_19_var.inner, ret_conv_19_var.is_owned);
33415                 ret_arr_ptr[t] = ret_conv_19_ref;
33416         }
33417         
33418         FREE(ret_var.data);
33419         return ret_arr;
33420 }
33421
33422 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fulfill_htlcs"))) TS_CommitmentUpdate_set_update_fulfill_htlcs(uint64_t this_ptr, uint64_tArray val) {
33423         LDKCommitmentUpdate this_ptr_conv;
33424         this_ptr_conv.inner = untag_ptr(this_ptr);
33425         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33427         this_ptr_conv.is_owned = false;
33428         LDKCVec_UpdateFulfillHTLCZ val_constr;
33429         val_constr.datalen = val->arr_len;
33430         if (val_constr.datalen > 0)
33431                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
33432         else
33433                 val_constr.data = NULL;
33434         uint64_t* val_vals = val->elems;
33435         for (size_t t = 0; t < val_constr.datalen; t++) {
33436                 uint64_t val_conv_19 = val_vals[t];
33437                 LDKUpdateFulfillHTLC val_conv_19_conv;
33438                 val_conv_19_conv.inner = untag_ptr(val_conv_19);
33439                 val_conv_19_conv.is_owned = ptr_is_owned(val_conv_19);
33440                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
33441                 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
33442                 val_constr.data[t] = val_conv_19_conv;
33443         }
33444         FREE(val);
33445         CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
33446 }
33447
33448 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_htlcs"))) TS_CommitmentUpdate_get_update_fail_htlcs(uint64_t this_ptr) {
33449         LDKCommitmentUpdate this_ptr_conv;
33450         this_ptr_conv.inner = untag_ptr(this_ptr);
33451         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33453         this_ptr_conv.is_owned = false;
33454         LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
33455         uint64_tArray ret_arr = NULL;
33456         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
33457         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
33458         for (size_t q = 0; q < ret_var.datalen; q++) {
33459                 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
33460                 uint64_t ret_conv_16_ref = 0;
33461                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
33462                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
33463                 ret_arr_ptr[q] = ret_conv_16_ref;
33464         }
33465         
33466         FREE(ret_var.data);
33467         return ret_arr;
33468 }
33469
33470 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fail_htlcs"))) TS_CommitmentUpdate_set_update_fail_htlcs(uint64_t this_ptr, uint64_tArray val) {
33471         LDKCommitmentUpdate this_ptr_conv;
33472         this_ptr_conv.inner = untag_ptr(this_ptr);
33473         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33475         this_ptr_conv.is_owned = false;
33476         LDKCVec_UpdateFailHTLCZ val_constr;
33477         val_constr.datalen = val->arr_len;
33478         if (val_constr.datalen > 0)
33479                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
33480         else
33481                 val_constr.data = NULL;
33482         uint64_t* val_vals = val->elems;
33483         for (size_t q = 0; q < val_constr.datalen; q++) {
33484                 uint64_t val_conv_16 = val_vals[q];
33485                 LDKUpdateFailHTLC val_conv_16_conv;
33486                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
33487                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
33488                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
33489                 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
33490                 val_constr.data[q] = val_conv_16_conv;
33491         }
33492         FREE(val);
33493         CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
33494 }
33495
33496 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_malformed_htlcs"))) TS_CommitmentUpdate_get_update_fail_malformed_htlcs(uint64_t this_ptr) {
33497         LDKCommitmentUpdate this_ptr_conv;
33498         this_ptr_conv.inner = untag_ptr(this_ptr);
33499         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33501         this_ptr_conv.is_owned = false;
33502         LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
33503         uint64_tArray ret_arr = NULL;
33504         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
33505         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
33506         for (size_t z = 0; z < ret_var.datalen; z++) {
33507                 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
33508                 uint64_t ret_conv_25_ref = 0;
33509                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
33510                 ret_conv_25_ref = tag_ptr(ret_conv_25_var.inner, ret_conv_25_var.is_owned);
33511                 ret_arr_ptr[z] = ret_conv_25_ref;
33512         }
33513         
33514         FREE(ret_var.data);
33515         return ret_arr;
33516 }
33517
33518 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) {
33519         LDKCommitmentUpdate this_ptr_conv;
33520         this_ptr_conv.inner = untag_ptr(this_ptr);
33521         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33523         this_ptr_conv.is_owned = false;
33524         LDKCVec_UpdateFailMalformedHTLCZ val_constr;
33525         val_constr.datalen = val->arr_len;
33526         if (val_constr.datalen > 0)
33527                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
33528         else
33529                 val_constr.data = NULL;
33530         uint64_t* val_vals = val->elems;
33531         for (size_t z = 0; z < val_constr.datalen; z++) {
33532                 uint64_t val_conv_25 = val_vals[z];
33533                 LDKUpdateFailMalformedHTLC val_conv_25_conv;
33534                 val_conv_25_conv.inner = untag_ptr(val_conv_25);
33535                 val_conv_25_conv.is_owned = ptr_is_owned(val_conv_25);
33536                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
33537                 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
33538                 val_constr.data[z] = val_conv_25_conv;
33539         }
33540         FREE(val);
33541         CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
33542 }
33543
33544 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_get_update_fee"))) TS_CommitmentUpdate_get_update_fee(uint64_t this_ptr) {
33545         LDKCommitmentUpdate this_ptr_conv;
33546         this_ptr_conv.inner = untag_ptr(this_ptr);
33547         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33549         this_ptr_conv.is_owned = false;
33550         LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
33551         uint64_t ret_ref = 0;
33552         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33553         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33554         return ret_ref;
33555 }
33556
33557 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fee"))) TS_CommitmentUpdate_set_update_fee(uint64_t this_ptr, uint64_t val) {
33558         LDKCommitmentUpdate this_ptr_conv;
33559         this_ptr_conv.inner = untag_ptr(this_ptr);
33560         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33562         this_ptr_conv.is_owned = false;
33563         LDKUpdateFee val_conv;
33564         val_conv.inner = untag_ptr(val);
33565         val_conv.is_owned = ptr_is_owned(val);
33566         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33567         val_conv = UpdateFee_clone(&val_conv);
33568         CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
33569 }
33570
33571 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_get_commitment_signed"))) TS_CommitmentUpdate_get_commitment_signed(uint64_t this_ptr) {
33572         LDKCommitmentUpdate this_ptr_conv;
33573         this_ptr_conv.inner = untag_ptr(this_ptr);
33574         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33576         this_ptr_conv.is_owned = false;
33577         LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
33578         uint64_t ret_ref = 0;
33579         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33580         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33581         return ret_ref;
33582 }
33583
33584 void  __attribute__((export_name("TS_CommitmentUpdate_set_commitment_signed"))) TS_CommitmentUpdate_set_commitment_signed(uint64_t this_ptr, uint64_t val) {
33585         LDKCommitmentUpdate this_ptr_conv;
33586         this_ptr_conv.inner = untag_ptr(this_ptr);
33587         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33589         this_ptr_conv.is_owned = false;
33590         LDKCommitmentSigned val_conv;
33591         val_conv.inner = untag_ptr(val);
33592         val_conv.is_owned = ptr_is_owned(val);
33593         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33594         val_conv = CommitmentSigned_clone(&val_conv);
33595         CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
33596 }
33597
33598 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) {
33599         LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
33600         update_add_htlcs_arg_constr.datalen = update_add_htlcs_arg->arr_len;
33601         if (update_add_htlcs_arg_constr.datalen > 0)
33602                 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
33603         else
33604                 update_add_htlcs_arg_constr.data = NULL;
33605         uint64_t* update_add_htlcs_arg_vals = update_add_htlcs_arg->elems;
33606         for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
33607                 uint64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
33608                 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
33609                 update_add_htlcs_arg_conv_15_conv.inner = untag_ptr(update_add_htlcs_arg_conv_15);
33610                 update_add_htlcs_arg_conv_15_conv.is_owned = ptr_is_owned(update_add_htlcs_arg_conv_15);
33611                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
33612                 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
33613                 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
33614         }
33615         FREE(update_add_htlcs_arg);
33616         LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
33617         update_fulfill_htlcs_arg_constr.datalen = update_fulfill_htlcs_arg->arr_len;
33618         if (update_fulfill_htlcs_arg_constr.datalen > 0)
33619                 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
33620         else
33621                 update_fulfill_htlcs_arg_constr.data = NULL;
33622         uint64_t* update_fulfill_htlcs_arg_vals = update_fulfill_htlcs_arg->elems;
33623         for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
33624                 uint64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
33625                 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
33626                 update_fulfill_htlcs_arg_conv_19_conv.inner = untag_ptr(update_fulfill_htlcs_arg_conv_19);
33627                 update_fulfill_htlcs_arg_conv_19_conv.is_owned = ptr_is_owned(update_fulfill_htlcs_arg_conv_19);
33628                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
33629                 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
33630                 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
33631         }
33632         FREE(update_fulfill_htlcs_arg);
33633         LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
33634         update_fail_htlcs_arg_constr.datalen = update_fail_htlcs_arg->arr_len;
33635         if (update_fail_htlcs_arg_constr.datalen > 0)
33636                 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
33637         else
33638                 update_fail_htlcs_arg_constr.data = NULL;
33639         uint64_t* update_fail_htlcs_arg_vals = update_fail_htlcs_arg->elems;
33640         for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
33641                 uint64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
33642                 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
33643                 update_fail_htlcs_arg_conv_16_conv.inner = untag_ptr(update_fail_htlcs_arg_conv_16);
33644                 update_fail_htlcs_arg_conv_16_conv.is_owned = ptr_is_owned(update_fail_htlcs_arg_conv_16);
33645                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
33646                 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
33647                 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
33648         }
33649         FREE(update_fail_htlcs_arg);
33650         LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
33651         update_fail_malformed_htlcs_arg_constr.datalen = update_fail_malformed_htlcs_arg->arr_len;
33652         if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
33653                 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
33654         else
33655                 update_fail_malformed_htlcs_arg_constr.data = NULL;
33656         uint64_t* update_fail_malformed_htlcs_arg_vals = update_fail_malformed_htlcs_arg->elems;
33657         for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
33658                 uint64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
33659                 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
33660                 update_fail_malformed_htlcs_arg_conv_25_conv.inner = untag_ptr(update_fail_malformed_htlcs_arg_conv_25);
33661                 update_fail_malformed_htlcs_arg_conv_25_conv.is_owned = ptr_is_owned(update_fail_malformed_htlcs_arg_conv_25);
33662                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
33663                 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
33664                 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
33665         }
33666         FREE(update_fail_malformed_htlcs_arg);
33667         LDKUpdateFee update_fee_arg_conv;
33668         update_fee_arg_conv.inner = untag_ptr(update_fee_arg);
33669         update_fee_arg_conv.is_owned = ptr_is_owned(update_fee_arg);
33670         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
33671         update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
33672         LDKCommitmentSigned commitment_signed_arg_conv;
33673         commitment_signed_arg_conv.inner = untag_ptr(commitment_signed_arg);
33674         commitment_signed_arg_conv.is_owned = ptr_is_owned(commitment_signed_arg);
33675         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
33676         commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
33677         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);
33678         uint64_t ret_ref = 0;
33679         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33680         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33681         return ret_ref;
33682 }
33683
33684 static inline uint64_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
33685         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
33686         uint64_t ret_ref = 0;
33687         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33688         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33689         return ret_ref;
33690 }
33691 int64_t  __attribute__((export_name("TS_CommitmentUpdate_clone_ptr"))) TS_CommitmentUpdate_clone_ptr(uint64_t arg) {
33692         LDKCommitmentUpdate arg_conv;
33693         arg_conv.inner = untag_ptr(arg);
33694         arg_conv.is_owned = ptr_is_owned(arg);
33695         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33696         arg_conv.is_owned = false;
33697         int64_t ret_conv = CommitmentUpdate_clone_ptr(&arg_conv);
33698         return ret_conv;
33699 }
33700
33701 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_clone"))) TS_CommitmentUpdate_clone(uint64_t orig) {
33702         LDKCommitmentUpdate orig_conv;
33703         orig_conv.inner = untag_ptr(orig);
33704         orig_conv.is_owned = ptr_is_owned(orig);
33705         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33706         orig_conv.is_owned = false;
33707         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
33708         uint64_t ret_ref = 0;
33709         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33710         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33711         return ret_ref;
33712 }
33713
33714 void  __attribute__((export_name("TS_ChannelMessageHandler_free"))) TS_ChannelMessageHandler_free(uint64_t this_ptr) {
33715         if (!ptr_is_owned(this_ptr)) return;
33716         void* this_ptr_ptr = untag_ptr(this_ptr);
33717         CHECK_ACCESS(this_ptr_ptr);
33718         LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
33719         FREE(untag_ptr(this_ptr));
33720         ChannelMessageHandler_free(this_ptr_conv);
33721 }
33722
33723 void  __attribute__((export_name("TS_RoutingMessageHandler_free"))) TS_RoutingMessageHandler_free(uint64_t this_ptr) {
33724         if (!ptr_is_owned(this_ptr)) return;
33725         void* this_ptr_ptr = untag_ptr(this_ptr);
33726         CHECK_ACCESS(this_ptr_ptr);
33727         LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
33728         FREE(untag_ptr(this_ptr));
33729         RoutingMessageHandler_free(this_ptr_conv);
33730 }
33731
33732 void  __attribute__((export_name("TS_OnionMessageHandler_free"))) TS_OnionMessageHandler_free(uint64_t this_ptr) {
33733         if (!ptr_is_owned(this_ptr)) return;
33734         void* this_ptr_ptr = untag_ptr(this_ptr);
33735         CHECK_ACCESS(this_ptr_ptr);
33736         LDKOnionMessageHandler this_ptr_conv = *(LDKOnionMessageHandler*)(this_ptr_ptr);
33737         FREE(untag_ptr(this_ptr));
33738         OnionMessageHandler_free(this_ptr_conv);
33739 }
33740
33741 int8_tArray  __attribute__((export_name("TS_AcceptChannel_write"))) TS_AcceptChannel_write(uint64_t obj) {
33742         LDKAcceptChannel obj_conv;
33743         obj_conv.inner = untag_ptr(obj);
33744         obj_conv.is_owned = ptr_is_owned(obj);
33745         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33746         obj_conv.is_owned = false;
33747         LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
33748         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33749         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33750         CVec_u8Z_free(ret_var);
33751         return ret_arr;
33752 }
33753
33754 uint64_t  __attribute__((export_name("TS_AcceptChannel_read"))) TS_AcceptChannel_read(int8_tArray ser) {
33755         LDKu8slice ser_ref;
33756         ser_ref.datalen = ser->arr_len;
33757         ser_ref.data = ser->elems;
33758         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
33759         *ret_conv = AcceptChannel_read(ser_ref);
33760         FREE(ser);
33761         return tag_ptr(ret_conv, true);
33762 }
33763
33764 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_write"))) TS_AnnouncementSignatures_write(uint64_t obj) {
33765         LDKAnnouncementSignatures obj_conv;
33766         obj_conv.inner = untag_ptr(obj);
33767         obj_conv.is_owned = ptr_is_owned(obj);
33768         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33769         obj_conv.is_owned = false;
33770         LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
33771         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33772         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33773         CVec_u8Z_free(ret_var);
33774         return ret_arr;
33775 }
33776
33777 uint64_t  __attribute__((export_name("TS_AnnouncementSignatures_read"))) TS_AnnouncementSignatures_read(int8_tArray ser) {
33778         LDKu8slice ser_ref;
33779         ser_ref.datalen = ser->arr_len;
33780         ser_ref.data = ser->elems;
33781         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
33782         *ret_conv = AnnouncementSignatures_read(ser_ref);
33783         FREE(ser);
33784         return tag_ptr(ret_conv, true);
33785 }
33786
33787 int8_tArray  __attribute__((export_name("TS_ChannelReestablish_write"))) TS_ChannelReestablish_write(uint64_t obj) {
33788         LDKChannelReestablish obj_conv;
33789         obj_conv.inner = untag_ptr(obj);
33790         obj_conv.is_owned = ptr_is_owned(obj);
33791         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33792         obj_conv.is_owned = false;
33793         LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
33794         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33795         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33796         CVec_u8Z_free(ret_var);
33797         return ret_arr;
33798 }
33799
33800 uint64_t  __attribute__((export_name("TS_ChannelReestablish_read"))) TS_ChannelReestablish_read(int8_tArray ser) {
33801         LDKu8slice ser_ref;
33802         ser_ref.datalen = ser->arr_len;
33803         ser_ref.data = ser->elems;
33804         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
33805         *ret_conv = ChannelReestablish_read(ser_ref);
33806         FREE(ser);
33807         return tag_ptr(ret_conv, true);
33808 }
33809
33810 int8_tArray  __attribute__((export_name("TS_ClosingSigned_write"))) TS_ClosingSigned_write(uint64_t obj) {
33811         LDKClosingSigned obj_conv;
33812         obj_conv.inner = untag_ptr(obj);
33813         obj_conv.is_owned = ptr_is_owned(obj);
33814         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33815         obj_conv.is_owned = false;
33816         LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
33817         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33818         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33819         CVec_u8Z_free(ret_var);
33820         return ret_arr;
33821 }
33822
33823 uint64_t  __attribute__((export_name("TS_ClosingSigned_read"))) TS_ClosingSigned_read(int8_tArray ser) {
33824         LDKu8slice ser_ref;
33825         ser_ref.datalen = ser->arr_len;
33826         ser_ref.data = ser->elems;
33827         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
33828         *ret_conv = ClosingSigned_read(ser_ref);
33829         FREE(ser);
33830         return tag_ptr(ret_conv, true);
33831 }
33832
33833 int8_tArray  __attribute__((export_name("TS_ClosingSignedFeeRange_write"))) TS_ClosingSignedFeeRange_write(uint64_t obj) {
33834         LDKClosingSignedFeeRange obj_conv;
33835         obj_conv.inner = untag_ptr(obj);
33836         obj_conv.is_owned = ptr_is_owned(obj);
33837         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33838         obj_conv.is_owned = false;
33839         LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
33840         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33841         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33842         CVec_u8Z_free(ret_var);
33843         return ret_arr;
33844 }
33845
33846 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_read"))) TS_ClosingSignedFeeRange_read(int8_tArray ser) {
33847         LDKu8slice ser_ref;
33848         ser_ref.datalen = ser->arr_len;
33849         ser_ref.data = ser->elems;
33850         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
33851         *ret_conv = ClosingSignedFeeRange_read(ser_ref);
33852         FREE(ser);
33853         return tag_ptr(ret_conv, true);
33854 }
33855
33856 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_write"))) TS_CommitmentSigned_write(uint64_t obj) {
33857         LDKCommitmentSigned obj_conv;
33858         obj_conv.inner = untag_ptr(obj);
33859         obj_conv.is_owned = ptr_is_owned(obj);
33860         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33861         obj_conv.is_owned = false;
33862         LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
33863         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33864         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33865         CVec_u8Z_free(ret_var);
33866         return ret_arr;
33867 }
33868
33869 uint64_t  __attribute__((export_name("TS_CommitmentSigned_read"))) TS_CommitmentSigned_read(int8_tArray ser) {
33870         LDKu8slice ser_ref;
33871         ser_ref.datalen = ser->arr_len;
33872         ser_ref.data = ser->elems;
33873         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
33874         *ret_conv = CommitmentSigned_read(ser_ref);
33875         FREE(ser);
33876         return tag_ptr(ret_conv, true);
33877 }
33878
33879 int8_tArray  __attribute__((export_name("TS_FundingCreated_write"))) TS_FundingCreated_write(uint64_t obj) {
33880         LDKFundingCreated obj_conv;
33881         obj_conv.inner = untag_ptr(obj);
33882         obj_conv.is_owned = ptr_is_owned(obj);
33883         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33884         obj_conv.is_owned = false;
33885         LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
33886         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33887         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33888         CVec_u8Z_free(ret_var);
33889         return ret_arr;
33890 }
33891
33892 uint64_t  __attribute__((export_name("TS_FundingCreated_read"))) TS_FundingCreated_read(int8_tArray ser) {
33893         LDKu8slice ser_ref;
33894         ser_ref.datalen = ser->arr_len;
33895         ser_ref.data = ser->elems;
33896         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
33897         *ret_conv = FundingCreated_read(ser_ref);
33898         FREE(ser);
33899         return tag_ptr(ret_conv, true);
33900 }
33901
33902 int8_tArray  __attribute__((export_name("TS_FundingSigned_write"))) TS_FundingSigned_write(uint64_t obj) {
33903         LDKFundingSigned obj_conv;
33904         obj_conv.inner = untag_ptr(obj);
33905         obj_conv.is_owned = ptr_is_owned(obj);
33906         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33907         obj_conv.is_owned = false;
33908         LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
33909         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33910         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33911         CVec_u8Z_free(ret_var);
33912         return ret_arr;
33913 }
33914
33915 uint64_t  __attribute__((export_name("TS_FundingSigned_read"))) TS_FundingSigned_read(int8_tArray ser) {
33916         LDKu8slice ser_ref;
33917         ser_ref.datalen = ser->arr_len;
33918         ser_ref.data = ser->elems;
33919         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
33920         *ret_conv = FundingSigned_read(ser_ref);
33921         FREE(ser);
33922         return tag_ptr(ret_conv, true);
33923 }
33924
33925 int8_tArray  __attribute__((export_name("TS_ChannelReady_write"))) TS_ChannelReady_write(uint64_t obj) {
33926         LDKChannelReady obj_conv;
33927         obj_conv.inner = untag_ptr(obj);
33928         obj_conv.is_owned = ptr_is_owned(obj);
33929         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33930         obj_conv.is_owned = false;
33931         LDKCVec_u8Z ret_var = ChannelReady_write(&obj_conv);
33932         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33933         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33934         CVec_u8Z_free(ret_var);
33935         return ret_arr;
33936 }
33937
33938 uint64_t  __attribute__((export_name("TS_ChannelReady_read"))) TS_ChannelReady_read(int8_tArray ser) {
33939         LDKu8slice ser_ref;
33940         ser_ref.datalen = ser->arr_len;
33941         ser_ref.data = ser->elems;
33942         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
33943         *ret_conv = ChannelReady_read(ser_ref);
33944         FREE(ser);
33945         return tag_ptr(ret_conv, true);
33946 }
33947
33948 int8_tArray  __attribute__((export_name("TS_Init_write"))) TS_Init_write(uint64_t obj) {
33949         LDKInit obj_conv;
33950         obj_conv.inner = untag_ptr(obj);
33951         obj_conv.is_owned = ptr_is_owned(obj);
33952         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33953         obj_conv.is_owned = false;
33954         LDKCVec_u8Z ret_var = Init_write(&obj_conv);
33955         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33956         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33957         CVec_u8Z_free(ret_var);
33958         return ret_arr;
33959 }
33960
33961 uint64_t  __attribute__((export_name("TS_Init_read"))) TS_Init_read(int8_tArray ser) {
33962         LDKu8slice ser_ref;
33963         ser_ref.datalen = ser->arr_len;
33964         ser_ref.data = ser->elems;
33965         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
33966         *ret_conv = Init_read(ser_ref);
33967         FREE(ser);
33968         return tag_ptr(ret_conv, true);
33969 }
33970
33971 int8_tArray  __attribute__((export_name("TS_OpenChannel_write"))) TS_OpenChannel_write(uint64_t obj) {
33972         LDKOpenChannel obj_conv;
33973         obj_conv.inner = untag_ptr(obj);
33974         obj_conv.is_owned = ptr_is_owned(obj);
33975         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33976         obj_conv.is_owned = false;
33977         LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
33978         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33979         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33980         CVec_u8Z_free(ret_var);
33981         return ret_arr;
33982 }
33983
33984 uint64_t  __attribute__((export_name("TS_OpenChannel_read"))) TS_OpenChannel_read(int8_tArray ser) {
33985         LDKu8slice ser_ref;
33986         ser_ref.datalen = ser->arr_len;
33987         ser_ref.data = ser->elems;
33988         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
33989         *ret_conv = OpenChannel_read(ser_ref);
33990         FREE(ser);
33991         return tag_ptr(ret_conv, true);
33992 }
33993
33994 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_write"))) TS_RevokeAndACK_write(uint64_t obj) {
33995         LDKRevokeAndACK obj_conv;
33996         obj_conv.inner = untag_ptr(obj);
33997         obj_conv.is_owned = ptr_is_owned(obj);
33998         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33999         obj_conv.is_owned = false;
34000         LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
34001         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34002         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34003         CVec_u8Z_free(ret_var);
34004         return ret_arr;
34005 }
34006
34007 uint64_t  __attribute__((export_name("TS_RevokeAndACK_read"))) TS_RevokeAndACK_read(int8_tArray ser) {
34008         LDKu8slice ser_ref;
34009         ser_ref.datalen = ser->arr_len;
34010         ser_ref.data = ser->elems;
34011         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
34012         *ret_conv = RevokeAndACK_read(ser_ref);
34013         FREE(ser);
34014         return tag_ptr(ret_conv, true);
34015 }
34016
34017 int8_tArray  __attribute__((export_name("TS_Shutdown_write"))) TS_Shutdown_write(uint64_t obj) {
34018         LDKShutdown obj_conv;
34019         obj_conv.inner = untag_ptr(obj);
34020         obj_conv.is_owned = ptr_is_owned(obj);
34021         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34022         obj_conv.is_owned = false;
34023         LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
34024         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34025         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34026         CVec_u8Z_free(ret_var);
34027         return ret_arr;
34028 }
34029
34030 uint64_t  __attribute__((export_name("TS_Shutdown_read"))) TS_Shutdown_read(int8_tArray ser) {
34031         LDKu8slice ser_ref;
34032         ser_ref.datalen = ser->arr_len;
34033         ser_ref.data = ser->elems;
34034         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
34035         *ret_conv = Shutdown_read(ser_ref);
34036         FREE(ser);
34037         return tag_ptr(ret_conv, true);
34038 }
34039
34040 int8_tArray  __attribute__((export_name("TS_UpdateFailHTLC_write"))) TS_UpdateFailHTLC_write(uint64_t obj) {
34041         LDKUpdateFailHTLC obj_conv;
34042         obj_conv.inner = untag_ptr(obj);
34043         obj_conv.is_owned = ptr_is_owned(obj);
34044         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34045         obj_conv.is_owned = false;
34046         LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
34047         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34048         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34049         CVec_u8Z_free(ret_var);
34050         return ret_arr;
34051 }
34052
34053 uint64_t  __attribute__((export_name("TS_UpdateFailHTLC_read"))) TS_UpdateFailHTLC_read(int8_tArray ser) {
34054         LDKu8slice ser_ref;
34055         ser_ref.datalen = ser->arr_len;
34056         ser_ref.data = ser->elems;
34057         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
34058         *ret_conv = UpdateFailHTLC_read(ser_ref);
34059         FREE(ser);
34060         return tag_ptr(ret_conv, true);
34061 }
34062
34063 int8_tArray  __attribute__((export_name("TS_UpdateFailMalformedHTLC_write"))) TS_UpdateFailMalformedHTLC_write(uint64_t obj) {
34064         LDKUpdateFailMalformedHTLC obj_conv;
34065         obj_conv.inner = untag_ptr(obj);
34066         obj_conv.is_owned = ptr_is_owned(obj);
34067         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34068         obj_conv.is_owned = false;
34069         LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
34070         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34071         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34072         CVec_u8Z_free(ret_var);
34073         return ret_arr;
34074 }
34075
34076 uint64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_read"))) TS_UpdateFailMalformedHTLC_read(int8_tArray ser) {
34077         LDKu8slice ser_ref;
34078         ser_ref.datalen = ser->arr_len;
34079         ser_ref.data = ser->elems;
34080         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
34081         *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
34082         FREE(ser);
34083         return tag_ptr(ret_conv, true);
34084 }
34085
34086 int8_tArray  __attribute__((export_name("TS_UpdateFee_write"))) TS_UpdateFee_write(uint64_t obj) {
34087         LDKUpdateFee obj_conv;
34088         obj_conv.inner = untag_ptr(obj);
34089         obj_conv.is_owned = ptr_is_owned(obj);
34090         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34091         obj_conv.is_owned = false;
34092         LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
34093         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34094         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34095         CVec_u8Z_free(ret_var);
34096         return ret_arr;
34097 }
34098
34099 uint64_t  __attribute__((export_name("TS_UpdateFee_read"))) TS_UpdateFee_read(int8_tArray ser) {
34100         LDKu8slice ser_ref;
34101         ser_ref.datalen = ser->arr_len;
34102         ser_ref.data = ser->elems;
34103         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
34104         *ret_conv = UpdateFee_read(ser_ref);
34105         FREE(ser);
34106         return tag_ptr(ret_conv, true);
34107 }
34108
34109 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_write"))) TS_UpdateFulfillHTLC_write(uint64_t obj) {
34110         LDKUpdateFulfillHTLC obj_conv;
34111         obj_conv.inner = untag_ptr(obj);
34112         obj_conv.is_owned = ptr_is_owned(obj);
34113         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34114         obj_conv.is_owned = false;
34115         LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
34116         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34117         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34118         CVec_u8Z_free(ret_var);
34119         return ret_arr;
34120 }
34121
34122 uint64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_read"))) TS_UpdateFulfillHTLC_read(int8_tArray ser) {
34123         LDKu8slice ser_ref;
34124         ser_ref.datalen = ser->arr_len;
34125         ser_ref.data = ser->elems;
34126         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
34127         *ret_conv = UpdateFulfillHTLC_read(ser_ref);
34128         FREE(ser);
34129         return tag_ptr(ret_conv, true);
34130 }
34131
34132 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_write"))) TS_UpdateAddHTLC_write(uint64_t obj) {
34133         LDKUpdateAddHTLC obj_conv;
34134         obj_conv.inner = untag_ptr(obj);
34135         obj_conv.is_owned = ptr_is_owned(obj);
34136         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34137         obj_conv.is_owned = false;
34138         LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
34139         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34140         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34141         CVec_u8Z_free(ret_var);
34142         return ret_arr;
34143 }
34144
34145 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_read"))) TS_UpdateAddHTLC_read(int8_tArray ser) {
34146         LDKu8slice ser_ref;
34147         ser_ref.datalen = ser->arr_len;
34148         ser_ref.data = ser->elems;
34149         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
34150         *ret_conv = UpdateAddHTLC_read(ser_ref);
34151         FREE(ser);
34152         return tag_ptr(ret_conv, true);
34153 }
34154
34155 uint64_t  __attribute__((export_name("TS_OnionMessage_read"))) TS_OnionMessage_read(int8_tArray ser) {
34156         LDKu8slice ser_ref;
34157         ser_ref.datalen = ser->arr_len;
34158         ser_ref.data = ser->elems;
34159         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
34160         *ret_conv = OnionMessage_read(ser_ref);
34161         FREE(ser);
34162         return tag_ptr(ret_conv, true);
34163 }
34164
34165 int8_tArray  __attribute__((export_name("TS_OnionMessage_write"))) TS_OnionMessage_write(uint64_t obj) {
34166         LDKOnionMessage obj_conv;
34167         obj_conv.inner = untag_ptr(obj);
34168         obj_conv.is_owned = ptr_is_owned(obj);
34169         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34170         obj_conv.is_owned = false;
34171         LDKCVec_u8Z ret_var = OnionMessage_write(&obj_conv);
34172         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34173         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34174         CVec_u8Z_free(ret_var);
34175         return ret_arr;
34176 }
34177
34178 int8_tArray  __attribute__((export_name("TS_Ping_write"))) TS_Ping_write(uint64_t obj) {
34179         LDKPing obj_conv;
34180         obj_conv.inner = untag_ptr(obj);
34181         obj_conv.is_owned = ptr_is_owned(obj);
34182         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34183         obj_conv.is_owned = false;
34184         LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
34185         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34186         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34187         CVec_u8Z_free(ret_var);
34188         return ret_arr;
34189 }
34190
34191 uint64_t  __attribute__((export_name("TS_Ping_read"))) TS_Ping_read(int8_tArray ser) {
34192         LDKu8slice ser_ref;
34193         ser_ref.datalen = ser->arr_len;
34194         ser_ref.data = ser->elems;
34195         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
34196         *ret_conv = Ping_read(ser_ref);
34197         FREE(ser);
34198         return tag_ptr(ret_conv, true);
34199 }
34200
34201 int8_tArray  __attribute__((export_name("TS_Pong_write"))) TS_Pong_write(uint64_t obj) {
34202         LDKPong obj_conv;
34203         obj_conv.inner = untag_ptr(obj);
34204         obj_conv.is_owned = ptr_is_owned(obj);
34205         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34206         obj_conv.is_owned = false;
34207         LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
34208         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34209         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34210         CVec_u8Z_free(ret_var);
34211         return ret_arr;
34212 }
34213
34214 uint64_t  __attribute__((export_name("TS_Pong_read"))) TS_Pong_read(int8_tArray ser) {
34215         LDKu8slice ser_ref;
34216         ser_ref.datalen = ser->arr_len;
34217         ser_ref.data = ser->elems;
34218         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
34219         *ret_conv = Pong_read(ser_ref);
34220         FREE(ser);
34221         return tag_ptr(ret_conv, true);
34222 }
34223
34224 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_write"))) TS_UnsignedChannelAnnouncement_write(uint64_t obj) {
34225         LDKUnsignedChannelAnnouncement obj_conv;
34226         obj_conv.inner = untag_ptr(obj);
34227         obj_conv.is_owned = ptr_is_owned(obj);
34228         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34229         obj_conv.is_owned = false;
34230         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
34231         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34232         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34233         CVec_u8Z_free(ret_var);
34234         return ret_arr;
34235 }
34236
34237 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_read"))) TS_UnsignedChannelAnnouncement_read(int8_tArray ser) {
34238         LDKu8slice ser_ref;
34239         ser_ref.datalen = ser->arr_len;
34240         ser_ref.data = ser->elems;
34241         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
34242         *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
34243         FREE(ser);
34244         return tag_ptr(ret_conv, true);
34245 }
34246
34247 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_write"))) TS_ChannelAnnouncement_write(uint64_t obj) {
34248         LDKChannelAnnouncement obj_conv;
34249         obj_conv.inner = untag_ptr(obj);
34250         obj_conv.is_owned = ptr_is_owned(obj);
34251         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34252         obj_conv.is_owned = false;
34253         LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
34254         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34255         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34256         CVec_u8Z_free(ret_var);
34257         return ret_arr;
34258 }
34259
34260 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_read"))) TS_ChannelAnnouncement_read(int8_tArray ser) {
34261         LDKu8slice ser_ref;
34262         ser_ref.datalen = ser->arr_len;
34263         ser_ref.data = ser->elems;
34264         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
34265         *ret_conv = ChannelAnnouncement_read(ser_ref);
34266         FREE(ser);
34267         return tag_ptr(ret_conv, true);
34268 }
34269
34270 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_write"))) TS_UnsignedChannelUpdate_write(uint64_t obj) {
34271         LDKUnsignedChannelUpdate obj_conv;
34272         obj_conv.inner = untag_ptr(obj);
34273         obj_conv.is_owned = ptr_is_owned(obj);
34274         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34275         obj_conv.is_owned = false;
34276         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
34277         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34278         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34279         CVec_u8Z_free(ret_var);
34280         return ret_arr;
34281 }
34282
34283 uint64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_read"))) TS_UnsignedChannelUpdate_read(int8_tArray ser) {
34284         LDKu8slice ser_ref;
34285         ser_ref.datalen = ser->arr_len;
34286         ser_ref.data = ser->elems;
34287         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
34288         *ret_conv = UnsignedChannelUpdate_read(ser_ref);
34289         FREE(ser);
34290         return tag_ptr(ret_conv, true);
34291 }
34292
34293 int8_tArray  __attribute__((export_name("TS_ChannelUpdate_write"))) TS_ChannelUpdate_write(uint64_t obj) {
34294         LDKChannelUpdate obj_conv;
34295         obj_conv.inner = untag_ptr(obj);
34296         obj_conv.is_owned = ptr_is_owned(obj);
34297         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34298         obj_conv.is_owned = false;
34299         LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
34300         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34301         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34302         CVec_u8Z_free(ret_var);
34303         return ret_arr;
34304 }
34305
34306 uint64_t  __attribute__((export_name("TS_ChannelUpdate_read"))) TS_ChannelUpdate_read(int8_tArray ser) {
34307         LDKu8slice ser_ref;
34308         ser_ref.datalen = ser->arr_len;
34309         ser_ref.data = ser->elems;
34310         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
34311         *ret_conv = ChannelUpdate_read(ser_ref);
34312         FREE(ser);
34313         return tag_ptr(ret_conv, true);
34314 }
34315
34316 int8_tArray  __attribute__((export_name("TS_ErrorMessage_write"))) TS_ErrorMessage_write(uint64_t obj) {
34317         LDKErrorMessage obj_conv;
34318         obj_conv.inner = untag_ptr(obj);
34319         obj_conv.is_owned = ptr_is_owned(obj);
34320         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34321         obj_conv.is_owned = false;
34322         LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
34323         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34324         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34325         CVec_u8Z_free(ret_var);
34326         return ret_arr;
34327 }
34328
34329 uint64_t  __attribute__((export_name("TS_ErrorMessage_read"))) TS_ErrorMessage_read(int8_tArray ser) {
34330         LDKu8slice ser_ref;
34331         ser_ref.datalen = ser->arr_len;
34332         ser_ref.data = ser->elems;
34333         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
34334         *ret_conv = ErrorMessage_read(ser_ref);
34335         FREE(ser);
34336         return tag_ptr(ret_conv, true);
34337 }
34338
34339 int8_tArray  __attribute__((export_name("TS_WarningMessage_write"))) TS_WarningMessage_write(uint64_t obj) {
34340         LDKWarningMessage obj_conv;
34341         obj_conv.inner = untag_ptr(obj);
34342         obj_conv.is_owned = ptr_is_owned(obj);
34343         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34344         obj_conv.is_owned = false;
34345         LDKCVec_u8Z ret_var = WarningMessage_write(&obj_conv);
34346         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34347         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34348         CVec_u8Z_free(ret_var);
34349         return ret_arr;
34350 }
34351
34352 uint64_t  __attribute__((export_name("TS_WarningMessage_read"))) TS_WarningMessage_read(int8_tArray ser) {
34353         LDKu8slice ser_ref;
34354         ser_ref.datalen = ser->arr_len;
34355         ser_ref.data = ser->elems;
34356         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
34357         *ret_conv = WarningMessage_read(ser_ref);
34358         FREE(ser);
34359         return tag_ptr(ret_conv, true);
34360 }
34361
34362 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_write"))) TS_UnsignedNodeAnnouncement_write(uint64_t obj) {
34363         LDKUnsignedNodeAnnouncement obj_conv;
34364         obj_conv.inner = untag_ptr(obj);
34365         obj_conv.is_owned = ptr_is_owned(obj);
34366         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34367         obj_conv.is_owned = false;
34368         LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
34369         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34370         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34371         CVec_u8Z_free(ret_var);
34372         return ret_arr;
34373 }
34374
34375 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_read"))) TS_UnsignedNodeAnnouncement_read(int8_tArray ser) {
34376         LDKu8slice ser_ref;
34377         ser_ref.datalen = ser->arr_len;
34378         ser_ref.data = ser->elems;
34379         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
34380         *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
34381         FREE(ser);
34382         return tag_ptr(ret_conv, true);
34383 }
34384
34385 int8_tArray  __attribute__((export_name("TS_NodeAnnouncement_write"))) TS_NodeAnnouncement_write(uint64_t obj) {
34386         LDKNodeAnnouncement obj_conv;
34387         obj_conv.inner = untag_ptr(obj);
34388         obj_conv.is_owned = ptr_is_owned(obj);
34389         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34390         obj_conv.is_owned = false;
34391         LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
34392         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34393         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34394         CVec_u8Z_free(ret_var);
34395         return ret_arr;
34396 }
34397
34398 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_read"))) TS_NodeAnnouncement_read(int8_tArray ser) {
34399         LDKu8slice ser_ref;
34400         ser_ref.datalen = ser->arr_len;
34401         ser_ref.data = ser->elems;
34402         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
34403         *ret_conv = NodeAnnouncement_read(ser_ref);
34404         FREE(ser);
34405         return tag_ptr(ret_conv, true);
34406 }
34407
34408 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_read"))) TS_QueryShortChannelIds_read(int8_tArray ser) {
34409         LDKu8slice ser_ref;
34410         ser_ref.datalen = ser->arr_len;
34411         ser_ref.data = ser->elems;
34412         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
34413         *ret_conv = QueryShortChannelIds_read(ser_ref);
34414         FREE(ser);
34415         return tag_ptr(ret_conv, true);
34416 }
34417
34418 int8_tArray  __attribute__((export_name("TS_QueryShortChannelIds_write"))) TS_QueryShortChannelIds_write(uint64_t obj) {
34419         LDKQueryShortChannelIds obj_conv;
34420         obj_conv.inner = untag_ptr(obj);
34421         obj_conv.is_owned = ptr_is_owned(obj);
34422         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34423         obj_conv.is_owned = false;
34424         LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
34425         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34426         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34427         CVec_u8Z_free(ret_var);
34428         return ret_arr;
34429 }
34430
34431 int8_tArray  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_write"))) TS_ReplyShortChannelIdsEnd_write(uint64_t obj) {
34432         LDKReplyShortChannelIdsEnd obj_conv;
34433         obj_conv.inner = untag_ptr(obj);
34434         obj_conv.is_owned = ptr_is_owned(obj);
34435         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34436         obj_conv.is_owned = false;
34437         LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
34438         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34439         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34440         CVec_u8Z_free(ret_var);
34441         return ret_arr;
34442 }
34443
34444 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_read"))) TS_ReplyShortChannelIdsEnd_read(int8_tArray ser) {
34445         LDKu8slice ser_ref;
34446         ser_ref.datalen = ser->arr_len;
34447         ser_ref.data = ser->elems;
34448         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
34449         *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
34450         FREE(ser);
34451         return tag_ptr(ret_conv, true);
34452 }
34453
34454 int32_t  __attribute__((export_name("TS_QueryChannelRange_end_blocknum"))) TS_QueryChannelRange_end_blocknum(uint64_t this_arg) {
34455         LDKQueryChannelRange this_arg_conv;
34456         this_arg_conv.inner = untag_ptr(this_arg);
34457         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34459         this_arg_conv.is_owned = false;
34460         int32_t ret_conv = QueryChannelRange_end_blocknum(&this_arg_conv);
34461         return ret_conv;
34462 }
34463
34464 int8_tArray  __attribute__((export_name("TS_QueryChannelRange_write"))) TS_QueryChannelRange_write(uint64_t obj) {
34465         LDKQueryChannelRange obj_conv;
34466         obj_conv.inner = untag_ptr(obj);
34467         obj_conv.is_owned = ptr_is_owned(obj);
34468         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34469         obj_conv.is_owned = false;
34470         LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
34471         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34472         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34473         CVec_u8Z_free(ret_var);
34474         return ret_arr;
34475 }
34476
34477 uint64_t  __attribute__((export_name("TS_QueryChannelRange_read"))) TS_QueryChannelRange_read(int8_tArray ser) {
34478         LDKu8slice ser_ref;
34479         ser_ref.datalen = ser->arr_len;
34480         ser_ref.data = ser->elems;
34481         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
34482         *ret_conv = QueryChannelRange_read(ser_ref);
34483         FREE(ser);
34484         return tag_ptr(ret_conv, true);
34485 }
34486
34487 uint64_t  __attribute__((export_name("TS_ReplyChannelRange_read"))) TS_ReplyChannelRange_read(int8_tArray ser) {
34488         LDKu8slice ser_ref;
34489         ser_ref.datalen = ser->arr_len;
34490         ser_ref.data = ser->elems;
34491         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
34492         *ret_conv = ReplyChannelRange_read(ser_ref);
34493         FREE(ser);
34494         return tag_ptr(ret_conv, true);
34495 }
34496
34497 int8_tArray  __attribute__((export_name("TS_ReplyChannelRange_write"))) TS_ReplyChannelRange_write(uint64_t obj) {
34498         LDKReplyChannelRange obj_conv;
34499         obj_conv.inner = untag_ptr(obj);
34500         obj_conv.is_owned = ptr_is_owned(obj);
34501         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34502         obj_conv.is_owned = false;
34503         LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
34504         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34505         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34506         CVec_u8Z_free(ret_var);
34507         return ret_arr;
34508 }
34509
34510 int8_tArray  __attribute__((export_name("TS_GossipTimestampFilter_write"))) TS_GossipTimestampFilter_write(uint64_t obj) {
34511         LDKGossipTimestampFilter obj_conv;
34512         obj_conv.inner = untag_ptr(obj);
34513         obj_conv.is_owned = ptr_is_owned(obj);
34514         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34515         obj_conv.is_owned = false;
34516         LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
34517         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34518         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34519         CVec_u8Z_free(ret_var);
34520         return ret_arr;
34521 }
34522
34523 uint64_t  __attribute__((export_name("TS_GossipTimestampFilter_read"))) TS_GossipTimestampFilter_read(int8_tArray ser) {
34524         LDKu8slice ser_ref;
34525         ser_ref.datalen = ser->arr_len;
34526         ser_ref.data = ser->elems;
34527         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
34528         *ret_conv = GossipTimestampFilter_read(ser_ref);
34529         FREE(ser);
34530         return tag_ptr(ret_conv, true);
34531 }
34532
34533 void  __attribute__((export_name("TS_CustomMessageHandler_free"))) TS_CustomMessageHandler_free(uint64_t this_ptr) {
34534         if (!ptr_is_owned(this_ptr)) return;
34535         void* this_ptr_ptr = untag_ptr(this_ptr);
34536         CHECK_ACCESS(this_ptr_ptr);
34537         LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
34538         FREE(untag_ptr(this_ptr));
34539         CustomMessageHandler_free(this_ptr_conv);
34540 }
34541
34542 void  __attribute__((export_name("TS_IgnoringMessageHandler_free"))) TS_IgnoringMessageHandler_free(uint64_t this_obj) {
34543         LDKIgnoringMessageHandler this_obj_conv;
34544         this_obj_conv.inner = untag_ptr(this_obj);
34545         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34547         IgnoringMessageHandler_free(this_obj_conv);
34548 }
34549
34550 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_new"))) TS_IgnoringMessageHandler_new() {
34551         LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
34552         uint64_t ret_ref = 0;
34553         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34554         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34555         return ret_ref;
34556 }
34557
34558 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_MessageSendEventsProvider"))) TS_IgnoringMessageHandler_as_MessageSendEventsProvider(uint64_t this_arg) {
34559         LDKIgnoringMessageHandler this_arg_conv;
34560         this_arg_conv.inner = untag_ptr(this_arg);
34561         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34563         this_arg_conv.is_owned = false;
34564         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
34565         *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
34566         return tag_ptr(ret_ret, true);
34567 }
34568
34569 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_RoutingMessageHandler"))) TS_IgnoringMessageHandler_as_RoutingMessageHandler(uint64_t this_arg) {
34570         LDKIgnoringMessageHandler this_arg_conv;
34571         this_arg_conv.inner = untag_ptr(this_arg);
34572         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34574         this_arg_conv.is_owned = false;
34575         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
34576         *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
34577         return tag_ptr(ret_ret, true);
34578 }
34579
34580 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_OnionMessageProvider"))) TS_IgnoringMessageHandler_as_OnionMessageProvider(uint64_t this_arg) {
34581         LDKIgnoringMessageHandler this_arg_conv;
34582         this_arg_conv.inner = untag_ptr(this_arg);
34583         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34585         this_arg_conv.is_owned = false;
34586         LDKOnionMessageProvider* ret_ret = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
34587         *ret_ret = IgnoringMessageHandler_as_OnionMessageProvider(&this_arg_conv);
34588         return tag_ptr(ret_ret, true);
34589 }
34590
34591 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_OnionMessageHandler"))) TS_IgnoringMessageHandler_as_OnionMessageHandler(uint64_t this_arg) {
34592         LDKIgnoringMessageHandler this_arg_conv;
34593         this_arg_conv.inner = untag_ptr(this_arg);
34594         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34596         this_arg_conv.is_owned = false;
34597         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
34598         *ret_ret = IgnoringMessageHandler_as_OnionMessageHandler(&this_arg_conv);
34599         return tag_ptr(ret_ret, true);
34600 }
34601
34602 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageReader"))) TS_IgnoringMessageHandler_as_CustomMessageReader(uint64_t this_arg) {
34603         LDKIgnoringMessageHandler this_arg_conv;
34604         this_arg_conv.inner = untag_ptr(this_arg);
34605         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34607         this_arg_conv.is_owned = false;
34608         LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
34609         *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
34610         return tag_ptr(ret_ret, true);
34611 }
34612
34613 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageHandler"))) TS_IgnoringMessageHandler_as_CustomMessageHandler(uint64_t this_arg) {
34614         LDKIgnoringMessageHandler this_arg_conv;
34615         this_arg_conv.inner = untag_ptr(this_arg);
34616         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34618         this_arg_conv.is_owned = false;
34619         LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
34620         *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
34621         return tag_ptr(ret_ret, true);
34622 }
34623
34624 void  __attribute__((export_name("TS_ErroringMessageHandler_free"))) TS_ErroringMessageHandler_free(uint64_t this_obj) {
34625         LDKErroringMessageHandler this_obj_conv;
34626         this_obj_conv.inner = untag_ptr(this_obj);
34627         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34629         ErroringMessageHandler_free(this_obj_conv);
34630 }
34631
34632 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_new"))) TS_ErroringMessageHandler_new() {
34633         LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
34634         uint64_t ret_ref = 0;
34635         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34636         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34637         return ret_ref;
34638 }
34639
34640 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_as_MessageSendEventsProvider"))) TS_ErroringMessageHandler_as_MessageSendEventsProvider(uint64_t this_arg) {
34641         LDKErroringMessageHandler this_arg_conv;
34642         this_arg_conv.inner = untag_ptr(this_arg);
34643         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34645         this_arg_conv.is_owned = false;
34646         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
34647         *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
34648         return tag_ptr(ret_ret, true);
34649 }
34650
34651 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_as_ChannelMessageHandler"))) TS_ErroringMessageHandler_as_ChannelMessageHandler(uint64_t this_arg) {
34652         LDKErroringMessageHandler this_arg_conv;
34653         this_arg_conv.inner = untag_ptr(this_arg);
34654         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34656         this_arg_conv.is_owned = false;
34657         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
34658         *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
34659         return tag_ptr(ret_ret, true);
34660 }
34661
34662 void  __attribute__((export_name("TS_MessageHandler_free"))) TS_MessageHandler_free(uint64_t this_obj) {
34663         LDKMessageHandler this_obj_conv;
34664         this_obj_conv.inner = untag_ptr(this_obj);
34665         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34666         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34667         MessageHandler_free(this_obj_conv);
34668 }
34669
34670 uint64_t  __attribute__((export_name("TS_MessageHandler_get_chan_handler"))) TS_MessageHandler_get_chan_handler(uint64_t this_ptr) {
34671         LDKMessageHandler this_ptr_conv;
34672         this_ptr_conv.inner = untag_ptr(this_ptr);
34673         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34675         this_ptr_conv.is_owned = false;
34676         // WARNING: This object doesn't live past this scope, needs clone!
34677         uint64_t ret_ret = tag_ptr(MessageHandler_get_chan_handler(&this_ptr_conv), false);
34678         return ret_ret;
34679 }
34680
34681 void  __attribute__((export_name("TS_MessageHandler_set_chan_handler"))) TS_MessageHandler_set_chan_handler(uint64_t this_ptr, uint64_t val) {
34682         LDKMessageHandler this_ptr_conv;
34683         this_ptr_conv.inner = untag_ptr(this_ptr);
34684         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34685         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34686         this_ptr_conv.is_owned = false;
34687         void* val_ptr = untag_ptr(val);
34688         CHECK_ACCESS(val_ptr);
34689         LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
34690         if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
34691                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34692                 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
34693         }
34694         MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
34695 }
34696
34697 uint64_t  __attribute__((export_name("TS_MessageHandler_get_route_handler"))) TS_MessageHandler_get_route_handler(uint64_t this_ptr) {
34698         LDKMessageHandler this_ptr_conv;
34699         this_ptr_conv.inner = untag_ptr(this_ptr);
34700         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34702         this_ptr_conv.is_owned = false;
34703         // WARNING: This object doesn't live past this scope, needs clone!
34704         uint64_t ret_ret = tag_ptr(MessageHandler_get_route_handler(&this_ptr_conv), false);
34705         return ret_ret;
34706 }
34707
34708 void  __attribute__((export_name("TS_MessageHandler_set_route_handler"))) TS_MessageHandler_set_route_handler(uint64_t this_ptr, uint64_t val) {
34709         LDKMessageHandler this_ptr_conv;
34710         this_ptr_conv.inner = untag_ptr(this_ptr);
34711         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34713         this_ptr_conv.is_owned = false;
34714         void* val_ptr = untag_ptr(val);
34715         CHECK_ACCESS(val_ptr);
34716         LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
34717         if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
34718                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34719                 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
34720         }
34721         MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
34722 }
34723
34724 uint64_t  __attribute__((export_name("TS_MessageHandler_get_onion_message_handler"))) TS_MessageHandler_get_onion_message_handler(uint64_t this_ptr) {
34725         LDKMessageHandler this_ptr_conv;
34726         this_ptr_conv.inner = untag_ptr(this_ptr);
34727         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34729         this_ptr_conv.is_owned = false;
34730         // WARNING: This object doesn't live past this scope, needs clone!
34731         uint64_t ret_ret = tag_ptr(MessageHandler_get_onion_message_handler(&this_ptr_conv), false);
34732         return ret_ret;
34733 }
34734
34735 void  __attribute__((export_name("TS_MessageHandler_set_onion_message_handler"))) TS_MessageHandler_set_onion_message_handler(uint64_t this_ptr, uint64_t val) {
34736         LDKMessageHandler this_ptr_conv;
34737         this_ptr_conv.inner = untag_ptr(this_ptr);
34738         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34740         this_ptr_conv.is_owned = false;
34741         void* val_ptr = untag_ptr(val);
34742         CHECK_ACCESS(val_ptr);
34743         LDKOnionMessageHandler val_conv = *(LDKOnionMessageHandler*)(val_ptr);
34744         if (val_conv.free == LDKOnionMessageHandler_JCalls_free) {
34745                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34746                 LDKOnionMessageHandler_JCalls_cloned(&val_conv);
34747         }
34748         MessageHandler_set_onion_message_handler(&this_ptr_conv, val_conv);
34749 }
34750
34751 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) {
34752         void* chan_handler_arg_ptr = untag_ptr(chan_handler_arg);
34753         CHECK_ACCESS(chan_handler_arg_ptr);
34754         LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
34755         if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
34756                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34757                 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
34758         }
34759         void* route_handler_arg_ptr = untag_ptr(route_handler_arg);
34760         CHECK_ACCESS(route_handler_arg_ptr);
34761         LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
34762         if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
34763                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34764                 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
34765         }
34766         void* onion_message_handler_arg_ptr = untag_ptr(onion_message_handler_arg);
34767         CHECK_ACCESS(onion_message_handler_arg_ptr);
34768         LDKOnionMessageHandler onion_message_handler_arg_conv = *(LDKOnionMessageHandler*)(onion_message_handler_arg_ptr);
34769         if (onion_message_handler_arg_conv.free == LDKOnionMessageHandler_JCalls_free) {
34770                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34771                 LDKOnionMessageHandler_JCalls_cloned(&onion_message_handler_arg_conv);
34772         }
34773         LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv, onion_message_handler_arg_conv);
34774         uint64_t ret_ref = 0;
34775         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34776         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34777         return ret_ref;
34778 }
34779
34780 static inline uint64_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
34781         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
34782         *ret_ret = SocketDescriptor_clone(arg);
34783         return tag_ptr(ret_ret, true);
34784 }
34785 int64_t  __attribute__((export_name("TS_SocketDescriptor_clone_ptr"))) TS_SocketDescriptor_clone_ptr(uint64_t arg) {
34786         void* arg_ptr = untag_ptr(arg);
34787         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
34788         LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
34789         int64_t ret_conv = SocketDescriptor_clone_ptr(arg_conv);
34790         return ret_conv;
34791 }
34792
34793 uint64_t  __attribute__((export_name("TS_SocketDescriptor_clone"))) TS_SocketDescriptor_clone(uint64_t orig) {
34794         void* orig_ptr = untag_ptr(orig);
34795         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
34796         LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
34797         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
34798         *ret_ret = SocketDescriptor_clone(orig_conv);
34799         return tag_ptr(ret_ret, true);
34800 }
34801
34802 void  __attribute__((export_name("TS_SocketDescriptor_free"))) TS_SocketDescriptor_free(uint64_t this_ptr) {
34803         if (!ptr_is_owned(this_ptr)) return;
34804         void* this_ptr_ptr = untag_ptr(this_ptr);
34805         CHECK_ACCESS(this_ptr_ptr);
34806         LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
34807         FREE(untag_ptr(this_ptr));
34808         SocketDescriptor_free(this_ptr_conv);
34809 }
34810
34811 void  __attribute__((export_name("TS_PeerHandleError_free"))) TS_PeerHandleError_free(uint64_t this_obj) {
34812         LDKPeerHandleError this_obj_conv;
34813         this_obj_conv.inner = untag_ptr(this_obj);
34814         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34816         PeerHandleError_free(this_obj_conv);
34817 }
34818
34819 jboolean  __attribute__((export_name("TS_PeerHandleError_get_no_connection_possible"))) TS_PeerHandleError_get_no_connection_possible(uint64_t this_ptr) {
34820         LDKPeerHandleError this_ptr_conv;
34821         this_ptr_conv.inner = untag_ptr(this_ptr);
34822         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34824         this_ptr_conv.is_owned = false;
34825         jboolean ret_conv = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
34826         return ret_conv;
34827 }
34828
34829 void  __attribute__((export_name("TS_PeerHandleError_set_no_connection_possible"))) TS_PeerHandleError_set_no_connection_possible(uint64_t this_ptr, jboolean val) {
34830         LDKPeerHandleError this_ptr_conv;
34831         this_ptr_conv.inner = untag_ptr(this_ptr);
34832         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34834         this_ptr_conv.is_owned = false;
34835         PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
34836 }
34837
34838 uint64_t  __attribute__((export_name("TS_PeerHandleError_new"))) TS_PeerHandleError_new(jboolean no_connection_possible_arg) {
34839         LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
34840         uint64_t ret_ref = 0;
34841         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34842         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34843         return ret_ref;
34844 }
34845
34846 static inline uint64_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
34847         LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
34848         uint64_t ret_ref = 0;
34849         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34850         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34851         return ret_ref;
34852 }
34853 int64_t  __attribute__((export_name("TS_PeerHandleError_clone_ptr"))) TS_PeerHandleError_clone_ptr(uint64_t arg) {
34854         LDKPeerHandleError arg_conv;
34855         arg_conv.inner = untag_ptr(arg);
34856         arg_conv.is_owned = ptr_is_owned(arg);
34857         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34858         arg_conv.is_owned = false;
34859         int64_t ret_conv = PeerHandleError_clone_ptr(&arg_conv);
34860         return ret_conv;
34861 }
34862
34863 uint64_t  __attribute__((export_name("TS_PeerHandleError_clone"))) TS_PeerHandleError_clone(uint64_t orig) {
34864         LDKPeerHandleError orig_conv;
34865         orig_conv.inner = untag_ptr(orig);
34866         orig_conv.is_owned = ptr_is_owned(orig);
34867         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34868         orig_conv.is_owned = false;
34869         LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
34870         uint64_t ret_ref = 0;
34871         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34872         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34873         return ret_ref;
34874 }
34875
34876 void  __attribute__((export_name("TS_PeerManager_free"))) TS_PeerManager_free(uint64_t this_obj) {
34877         LDKPeerManager this_obj_conv;
34878         this_obj_conv.inner = untag_ptr(this_obj);
34879         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34880         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34881         PeerManager_free(this_obj_conv);
34882 }
34883
34884 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) {
34885         LDKMessageHandler message_handler_conv;
34886         message_handler_conv.inner = untag_ptr(message_handler);
34887         message_handler_conv.is_owned = ptr_is_owned(message_handler);
34888         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
34889         // WARNING: we need a move here but no clone is available for LDKMessageHandler
34890         
34891         LDKSecretKey our_node_secret_ref;
34892         CHECK(our_node_secret->arr_len == 32);
34893         memcpy(our_node_secret_ref.bytes, our_node_secret->elems, 32); FREE(our_node_secret);
34894         unsigned char ephemeral_random_data_arr[32];
34895         CHECK(ephemeral_random_data->arr_len == 32);
34896         memcpy(ephemeral_random_data_arr, ephemeral_random_data->elems, 32); FREE(ephemeral_random_data);
34897         unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
34898         void* logger_ptr = untag_ptr(logger);
34899         CHECK_ACCESS(logger_ptr);
34900         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
34901         if (logger_conv.free == LDKLogger_JCalls_free) {
34902                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34903                 LDKLogger_JCalls_cloned(&logger_conv);
34904         }
34905         void* custom_message_handler_ptr = untag_ptr(custom_message_handler);
34906         CHECK_ACCESS(custom_message_handler_ptr);
34907         LDKCustomMessageHandler custom_message_handler_conv = *(LDKCustomMessageHandler*)(custom_message_handler_ptr);
34908         if (custom_message_handler_conv.free == LDKCustomMessageHandler_JCalls_free) {
34909                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34910                 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_conv);
34911         }
34912         LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, current_time, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv);
34913         uint64_t ret_ref = 0;
34914         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34915         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34916         return ret_ref;
34917 }
34918
34919 ptrArray  __attribute__((export_name("TS_PeerManager_get_peer_node_ids"))) TS_PeerManager_get_peer_node_ids(uint64_t this_arg) {
34920         LDKPeerManager this_arg_conv;
34921         this_arg_conv.inner = untag_ptr(this_arg);
34922         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34924         this_arg_conv.is_owned = false;
34925         LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
34926         ptrArray ret_arr = NULL;
34927         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
34928         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
34929         for (size_t m = 0; m < ret_var.datalen; m++) {
34930                 int8_tArray ret_conv_12_arr = init_int8_tArray(33, __LINE__);
34931                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compressed_form, 33);
34932                 ret_arr_ptr[m] = ret_conv_12_arr;
34933         }
34934         
34935         FREE(ret_var.data);
34936         return ret_arr;
34937 }
34938
34939 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) {
34940         LDKPeerManager this_arg_conv;
34941         this_arg_conv.inner = untag_ptr(this_arg);
34942         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34944         this_arg_conv.is_owned = false;
34945         LDKPublicKey their_node_id_ref;
34946         CHECK(their_node_id->arr_len == 33);
34947         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
34948         void* descriptor_ptr = untag_ptr(descriptor);
34949         CHECK_ACCESS(descriptor_ptr);
34950         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
34951         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
34952                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34953                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
34954         }
34955         void* remote_network_address_ptr = untag_ptr(remote_network_address);
34956         CHECK_ACCESS(remote_network_address_ptr);
34957         LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
34958         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
34959         *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv, remote_network_address_conv);
34960         return tag_ptr(ret_conv, true);
34961 }
34962
34963 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) {
34964         LDKPeerManager this_arg_conv;
34965         this_arg_conv.inner = untag_ptr(this_arg);
34966         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34968         this_arg_conv.is_owned = false;
34969         void* descriptor_ptr = untag_ptr(descriptor);
34970         CHECK_ACCESS(descriptor_ptr);
34971         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
34972         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
34973                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34974                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
34975         }
34976         void* remote_network_address_ptr = untag_ptr(remote_network_address);
34977         CHECK_ACCESS(remote_network_address_ptr);
34978         LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
34979         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
34980         *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv, remote_network_address_conv);
34981         return tag_ptr(ret_conv, true);
34982 }
34983
34984 uint64_t  __attribute__((export_name("TS_PeerManager_write_buffer_space_avail"))) TS_PeerManager_write_buffer_space_avail(uint64_t this_arg, uint64_t descriptor) {
34985         LDKPeerManager this_arg_conv;
34986         this_arg_conv.inner = untag_ptr(this_arg);
34987         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34989         this_arg_conv.is_owned = false;
34990         void* descriptor_ptr = untag_ptr(descriptor);
34991         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
34992         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
34993         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
34994         *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
34995         return tag_ptr(ret_conv, true);
34996 }
34997
34998 uint64_t  __attribute__((export_name("TS_PeerManager_read_event"))) TS_PeerManager_read_event(uint64_t this_arg, uint64_t peer_descriptor, int8_tArray data) {
34999         LDKPeerManager this_arg_conv;
35000         this_arg_conv.inner = untag_ptr(this_arg);
35001         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35003         this_arg_conv.is_owned = false;
35004         void* peer_descriptor_ptr = untag_ptr(peer_descriptor);
35005         if (ptr_is_owned(peer_descriptor)) { CHECK_ACCESS(peer_descriptor_ptr); }
35006         LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
35007         LDKu8slice data_ref;
35008         data_ref.datalen = data->arr_len;
35009         data_ref.data = data->elems;
35010         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
35011         *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
35012         FREE(data);
35013         return tag_ptr(ret_conv, true);
35014 }
35015
35016 void  __attribute__((export_name("TS_PeerManager_process_events"))) TS_PeerManager_process_events(uint64_t this_arg) {
35017         LDKPeerManager this_arg_conv;
35018         this_arg_conv.inner = untag_ptr(this_arg);
35019         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35021         this_arg_conv.is_owned = false;
35022         PeerManager_process_events(&this_arg_conv);
35023 }
35024
35025 void  __attribute__((export_name("TS_PeerManager_socket_disconnected"))) TS_PeerManager_socket_disconnected(uint64_t this_arg, uint64_t descriptor) {
35026         LDKPeerManager this_arg_conv;
35027         this_arg_conv.inner = untag_ptr(this_arg);
35028         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35030         this_arg_conv.is_owned = false;
35031         void* descriptor_ptr = untag_ptr(descriptor);
35032         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
35033         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
35034         PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
35035 }
35036
35037 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) {
35038         LDKPeerManager this_arg_conv;
35039         this_arg_conv.inner = untag_ptr(this_arg);
35040         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35042         this_arg_conv.is_owned = false;
35043         LDKPublicKey node_id_ref;
35044         CHECK(node_id->arr_len == 33);
35045         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
35046         PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
35047 }
35048
35049 void  __attribute__((export_name("TS_PeerManager_disconnect_all_peers"))) TS_PeerManager_disconnect_all_peers(uint64_t this_arg) {
35050         LDKPeerManager this_arg_conv;
35051         this_arg_conv.inner = untag_ptr(this_arg);
35052         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35054         this_arg_conv.is_owned = false;
35055         PeerManager_disconnect_all_peers(&this_arg_conv);
35056 }
35057
35058 void  __attribute__((export_name("TS_PeerManager_timer_tick_occurred"))) TS_PeerManager_timer_tick_occurred(uint64_t this_arg) {
35059         LDKPeerManager this_arg_conv;
35060         this_arg_conv.inner = untag_ptr(this_arg);
35061         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35063         this_arg_conv.is_owned = false;
35064         PeerManager_timer_tick_occurred(&this_arg_conv);
35065 }
35066
35067 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) {
35068         LDKPeerManager this_arg_conv;
35069         this_arg_conv.inner = untag_ptr(this_arg);
35070         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35071         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35072         this_arg_conv.is_owned = false;
35073         LDKThreeBytes rgb_ref;
35074         CHECK(rgb->arr_len == 3);
35075         memcpy(rgb_ref.data, rgb->elems, 3); FREE(rgb);
35076         LDKThirtyTwoBytes alias_ref;
35077         CHECK(alias->arr_len == 32);
35078         memcpy(alias_ref.data, alias->elems, 32); FREE(alias);
35079         LDKCVec_NetAddressZ addresses_constr;
35080         addresses_constr.datalen = addresses->arr_len;
35081         if (addresses_constr.datalen > 0)
35082                 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
35083         else
35084                 addresses_constr.data = NULL;
35085         uint64_t* addresses_vals = addresses->elems;
35086         for (size_t m = 0; m < addresses_constr.datalen; m++) {
35087                 uint64_t addresses_conv_12 = addresses_vals[m];
35088                 void* addresses_conv_12_ptr = untag_ptr(addresses_conv_12);
35089                 CHECK_ACCESS(addresses_conv_12_ptr);
35090                 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(addresses_conv_12_ptr);
35091                 addresses_constr.data[m] = addresses_conv_12_conv;
35092         }
35093         FREE(addresses);
35094         PeerManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
35095 }
35096
35097 int64_t  __attribute__((export_name("TS_htlc_success_tx_weight"))) TS_htlc_success_tx_weight(jboolean opt_anchors) {
35098         int64_t ret_conv = htlc_success_tx_weight(opt_anchors);
35099         return ret_conv;
35100 }
35101
35102 int64_t  __attribute__((export_name("TS_htlc_timeout_tx_weight"))) TS_htlc_timeout_tx_weight(jboolean opt_anchors) {
35103         int64_t ret_conv = htlc_timeout_tx_weight(opt_anchors);
35104         return ret_conv;
35105 }
35106
35107 int8_tArray  __attribute__((export_name("TS_build_commitment_secret"))) TS_build_commitment_secret(int8_tArray commitment_seed, int64_t idx) {
35108         unsigned char commitment_seed_arr[32];
35109         CHECK(commitment_seed->arr_len == 32);
35110         memcpy(commitment_seed_arr, commitment_seed->elems, 32); FREE(commitment_seed);
35111         unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
35112         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35113         memcpy(ret_arr->elems, build_commitment_secret(commitment_seed_ref, idx).data, 32);
35114         return ret_arr;
35115 }
35116
35117 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) {
35118         LDKCVec_u8Z to_holder_script_ref;
35119         to_holder_script_ref.datalen = to_holder_script->arr_len;
35120         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
35121         memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
35122         LDKCVec_u8Z to_counterparty_script_ref;
35123         to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
35124         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
35125         memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
35126         LDKOutPoint funding_outpoint_conv;
35127         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
35128         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
35129         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
35130         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
35131         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);
35132         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35133         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35134         Transaction_free(ret_var);
35135         return ret_arr;
35136 }
35137
35138 void  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_free"))) TS_CounterpartyCommitmentSecrets_free(uint64_t this_obj) {
35139         LDKCounterpartyCommitmentSecrets this_obj_conv;
35140         this_obj_conv.inner = untag_ptr(this_obj);
35141         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35143         CounterpartyCommitmentSecrets_free(this_obj_conv);
35144 }
35145
35146 static inline uint64_t CounterpartyCommitmentSecrets_clone_ptr(LDKCounterpartyCommitmentSecrets *NONNULL_PTR arg) {
35147         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(arg);
35148         uint64_t ret_ref = 0;
35149         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35150         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35151         return ret_ref;
35152 }
35153 int64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_clone_ptr"))) TS_CounterpartyCommitmentSecrets_clone_ptr(uint64_t arg) {
35154         LDKCounterpartyCommitmentSecrets arg_conv;
35155         arg_conv.inner = untag_ptr(arg);
35156         arg_conv.is_owned = ptr_is_owned(arg);
35157         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35158         arg_conv.is_owned = false;
35159         int64_t ret_conv = CounterpartyCommitmentSecrets_clone_ptr(&arg_conv);
35160         return ret_conv;
35161 }
35162
35163 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_clone"))) TS_CounterpartyCommitmentSecrets_clone(uint64_t orig) {
35164         LDKCounterpartyCommitmentSecrets orig_conv;
35165         orig_conv.inner = untag_ptr(orig);
35166         orig_conv.is_owned = ptr_is_owned(orig);
35167         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35168         orig_conv.is_owned = false;
35169         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(&orig_conv);
35170         uint64_t ret_ref = 0;
35171         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35172         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35173         return ret_ref;
35174 }
35175
35176 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_new"))) TS_CounterpartyCommitmentSecrets_new() {
35177         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_new();
35178         uint64_t ret_ref = 0;
35179         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35180         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35181         return ret_ref;
35182 }
35183
35184 int64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_get_min_seen_secret"))) TS_CounterpartyCommitmentSecrets_get_min_seen_secret(uint64_t this_arg) {
35185         LDKCounterpartyCommitmentSecrets this_arg_conv;
35186         this_arg_conv.inner = untag_ptr(this_arg);
35187         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35189         this_arg_conv.is_owned = false;
35190         int64_t ret_conv = CounterpartyCommitmentSecrets_get_min_seen_secret(&this_arg_conv);
35191         return ret_conv;
35192 }
35193
35194 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_provide_secret"))) TS_CounterpartyCommitmentSecrets_provide_secret(uint64_t this_arg, int64_t idx, int8_tArray secret) {
35195         LDKCounterpartyCommitmentSecrets this_arg_conv;
35196         this_arg_conv.inner = untag_ptr(this_arg);
35197         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35199         this_arg_conv.is_owned = false;
35200         LDKThirtyTwoBytes secret_ref;
35201         CHECK(secret->arr_len == 32);
35202         memcpy(secret_ref.data, secret->elems, 32); FREE(secret);
35203         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
35204         *ret_conv = CounterpartyCommitmentSecrets_provide_secret(&this_arg_conv, idx, secret_ref);
35205         return tag_ptr(ret_conv, true);
35206 }
35207
35208 int8_tArray  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_get_secret"))) TS_CounterpartyCommitmentSecrets_get_secret(uint64_t this_arg, int64_t idx) {
35209         LDKCounterpartyCommitmentSecrets this_arg_conv;
35210         this_arg_conv.inner = untag_ptr(this_arg);
35211         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35213         this_arg_conv.is_owned = false;
35214         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35215         memcpy(ret_arr->elems, CounterpartyCommitmentSecrets_get_secret(&this_arg_conv, idx).data, 32);
35216         return ret_arr;
35217 }
35218
35219 int8_tArray  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_write"))) TS_CounterpartyCommitmentSecrets_write(uint64_t obj) {
35220         LDKCounterpartyCommitmentSecrets obj_conv;
35221         obj_conv.inner = untag_ptr(obj);
35222         obj_conv.is_owned = ptr_is_owned(obj);
35223         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35224         obj_conv.is_owned = false;
35225         LDKCVec_u8Z ret_var = CounterpartyCommitmentSecrets_write(&obj_conv);
35226         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35227         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35228         CVec_u8Z_free(ret_var);
35229         return ret_arr;
35230 }
35231
35232 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_read"))) TS_CounterpartyCommitmentSecrets_read(int8_tArray ser) {
35233         LDKu8slice ser_ref;
35234         ser_ref.datalen = ser->arr_len;
35235         ser_ref.data = ser->elems;
35236         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
35237         *ret_conv = CounterpartyCommitmentSecrets_read(ser_ref);
35238         FREE(ser);
35239         return tag_ptr(ret_conv, true);
35240 }
35241
35242 uint64_t  __attribute__((export_name("TS_derive_private_key"))) TS_derive_private_key(int8_tArray per_commitment_point, int8_tArray base_secret) {
35243         LDKPublicKey per_commitment_point_ref;
35244         CHECK(per_commitment_point->arr_len == 33);
35245         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
35246         unsigned char base_secret_arr[32];
35247         CHECK(base_secret->arr_len == 32);
35248         memcpy(base_secret_arr, base_secret->elems, 32); FREE(base_secret);
35249         unsigned char (*base_secret_ref)[32] = &base_secret_arr;
35250         LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
35251         *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
35252         return tag_ptr(ret_conv, true);
35253 }
35254
35255 uint64_t  __attribute__((export_name("TS_derive_public_key"))) TS_derive_public_key(int8_tArray per_commitment_point, int8_tArray base_point) {
35256         LDKPublicKey per_commitment_point_ref;
35257         CHECK(per_commitment_point->arr_len == 33);
35258         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
35259         LDKPublicKey base_point_ref;
35260         CHECK(base_point->arr_len == 33);
35261         memcpy(base_point_ref.compressed_form, base_point->elems, 33); FREE(base_point);
35262         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
35263         *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
35264         return tag_ptr(ret_conv, true);
35265 }
35266
35267 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) {
35268         unsigned char per_commitment_secret_arr[32];
35269         CHECK(per_commitment_secret->arr_len == 32);
35270         memcpy(per_commitment_secret_arr, per_commitment_secret->elems, 32); FREE(per_commitment_secret);
35271         unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
35272         unsigned char countersignatory_revocation_base_secret_arr[32];
35273         CHECK(countersignatory_revocation_base_secret->arr_len == 32);
35274         memcpy(countersignatory_revocation_base_secret_arr, countersignatory_revocation_base_secret->elems, 32); FREE(countersignatory_revocation_base_secret);
35275         unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
35276         LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
35277         *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
35278         return tag_ptr(ret_conv, true);
35279 }
35280
35281 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) {
35282         LDKPublicKey per_commitment_point_ref;
35283         CHECK(per_commitment_point->arr_len == 33);
35284         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
35285         LDKPublicKey countersignatory_revocation_base_point_ref;
35286         CHECK(countersignatory_revocation_base_point->arr_len == 33);
35287         memcpy(countersignatory_revocation_base_point_ref.compressed_form, countersignatory_revocation_base_point->elems, 33); FREE(countersignatory_revocation_base_point);
35288         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
35289         *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
35290         return tag_ptr(ret_conv, true);
35291 }
35292
35293 void  __attribute__((export_name("TS_TxCreationKeys_free"))) TS_TxCreationKeys_free(uint64_t this_obj) {
35294         LDKTxCreationKeys this_obj_conv;
35295         this_obj_conv.inner = untag_ptr(this_obj);
35296         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35297         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35298         TxCreationKeys_free(this_obj_conv);
35299 }
35300
35301 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_per_commitment_point"))) TS_TxCreationKeys_get_per_commitment_point(uint64_t this_ptr) {
35302         LDKTxCreationKeys this_ptr_conv;
35303         this_ptr_conv.inner = untag_ptr(this_ptr);
35304         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35306         this_ptr_conv.is_owned = false;
35307         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35308         memcpy(ret_arr->elems, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
35309         return ret_arr;
35310 }
35311
35312 void  __attribute__((export_name("TS_TxCreationKeys_set_per_commitment_point"))) TS_TxCreationKeys_set_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
35313         LDKTxCreationKeys this_ptr_conv;
35314         this_ptr_conv.inner = untag_ptr(this_ptr);
35315         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35317         this_ptr_conv.is_owned = false;
35318         LDKPublicKey val_ref;
35319         CHECK(val->arr_len == 33);
35320         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
35321         TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
35322 }
35323
35324 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_revocation_key"))) TS_TxCreationKeys_get_revocation_key(uint64_t this_ptr) {
35325         LDKTxCreationKeys this_ptr_conv;
35326         this_ptr_conv.inner = untag_ptr(this_ptr);
35327         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35329         this_ptr_conv.is_owned = false;
35330         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35331         memcpy(ret_arr->elems, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form, 33);
35332         return ret_arr;
35333 }
35334
35335 void  __attribute__((export_name("TS_TxCreationKeys_set_revocation_key"))) TS_TxCreationKeys_set_revocation_key(uint64_t this_ptr, int8_tArray val) {
35336         LDKTxCreationKeys this_ptr_conv;
35337         this_ptr_conv.inner = untag_ptr(this_ptr);
35338         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35340         this_ptr_conv.is_owned = false;
35341         LDKPublicKey val_ref;
35342         CHECK(val->arr_len == 33);
35343         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
35344         TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
35345 }
35346
35347 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_htlc_key"))) TS_TxCreationKeys_get_broadcaster_htlc_key(uint64_t this_ptr) {
35348         LDKTxCreationKeys this_ptr_conv;
35349         this_ptr_conv.inner = untag_ptr(this_ptr);
35350         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35352         this_ptr_conv.is_owned = false;
35353         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35354         memcpy(ret_arr->elems, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form, 33);
35355         return ret_arr;
35356 }
35357
35358 void  __attribute__((export_name("TS_TxCreationKeys_set_broadcaster_htlc_key"))) TS_TxCreationKeys_set_broadcaster_htlc_key(uint64_t this_ptr, int8_tArray val) {
35359         LDKTxCreationKeys this_ptr_conv;
35360         this_ptr_conv.inner = untag_ptr(this_ptr);
35361         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35362         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35363         this_ptr_conv.is_owned = false;
35364         LDKPublicKey val_ref;
35365         CHECK(val->arr_len == 33);
35366         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
35367         TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
35368 }
35369
35370 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_countersignatory_htlc_key"))) TS_TxCreationKeys_get_countersignatory_htlc_key(uint64_t this_ptr) {
35371         LDKTxCreationKeys this_ptr_conv;
35372         this_ptr_conv.inner = untag_ptr(this_ptr);
35373         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35375         this_ptr_conv.is_owned = false;
35376         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35377         memcpy(ret_arr->elems, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form, 33);
35378         return ret_arr;
35379 }
35380
35381 void  __attribute__((export_name("TS_TxCreationKeys_set_countersignatory_htlc_key"))) TS_TxCreationKeys_set_countersignatory_htlc_key(uint64_t this_ptr, int8_tArray val) {
35382         LDKTxCreationKeys this_ptr_conv;
35383         this_ptr_conv.inner = untag_ptr(this_ptr);
35384         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35386         this_ptr_conv.is_owned = false;
35387         LDKPublicKey val_ref;
35388         CHECK(val->arr_len == 33);
35389         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
35390         TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
35391 }
35392
35393 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_delayed_payment_key"))) TS_TxCreationKeys_get_broadcaster_delayed_payment_key(uint64_t this_ptr) {
35394         LDKTxCreationKeys this_ptr_conv;
35395         this_ptr_conv.inner = untag_ptr(this_ptr);
35396         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35398         this_ptr_conv.is_owned = false;
35399         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35400         memcpy(ret_arr->elems, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form, 33);
35401         return ret_arr;
35402 }
35403
35404 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) {
35405         LDKTxCreationKeys this_ptr_conv;
35406         this_ptr_conv.inner = untag_ptr(this_ptr);
35407         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35409         this_ptr_conv.is_owned = false;
35410         LDKPublicKey val_ref;
35411         CHECK(val->arr_len == 33);
35412         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
35413         TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
35414 }
35415
35416 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) {
35417         LDKPublicKey per_commitment_point_arg_ref;
35418         CHECK(per_commitment_point_arg->arr_len == 33);
35419         memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
35420         LDKPublicKey revocation_key_arg_ref;
35421         CHECK(revocation_key_arg->arr_len == 33);
35422         memcpy(revocation_key_arg_ref.compressed_form, revocation_key_arg->elems, 33); FREE(revocation_key_arg);
35423         LDKPublicKey broadcaster_htlc_key_arg_ref;
35424         CHECK(broadcaster_htlc_key_arg->arr_len == 33);
35425         memcpy(broadcaster_htlc_key_arg_ref.compressed_form, broadcaster_htlc_key_arg->elems, 33); FREE(broadcaster_htlc_key_arg);
35426         LDKPublicKey countersignatory_htlc_key_arg_ref;
35427         CHECK(countersignatory_htlc_key_arg->arr_len == 33);
35428         memcpy(countersignatory_htlc_key_arg_ref.compressed_form, countersignatory_htlc_key_arg->elems, 33); FREE(countersignatory_htlc_key_arg);
35429         LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
35430         CHECK(broadcaster_delayed_payment_key_arg->arr_len == 33);
35431         memcpy(broadcaster_delayed_payment_key_arg_ref.compressed_form, broadcaster_delayed_payment_key_arg->elems, 33); FREE(broadcaster_delayed_payment_key_arg);
35432         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);
35433         uint64_t ret_ref = 0;
35434         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35435         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35436         return ret_ref;
35437 }
35438
35439 static inline uint64_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
35440         LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
35441         uint64_t ret_ref = 0;
35442         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35443         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35444         return ret_ref;
35445 }
35446 int64_t  __attribute__((export_name("TS_TxCreationKeys_clone_ptr"))) TS_TxCreationKeys_clone_ptr(uint64_t arg) {
35447         LDKTxCreationKeys arg_conv;
35448         arg_conv.inner = untag_ptr(arg);
35449         arg_conv.is_owned = ptr_is_owned(arg);
35450         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35451         arg_conv.is_owned = false;
35452         int64_t ret_conv = TxCreationKeys_clone_ptr(&arg_conv);
35453         return ret_conv;
35454 }
35455
35456 uint64_t  __attribute__((export_name("TS_TxCreationKeys_clone"))) TS_TxCreationKeys_clone(uint64_t orig) {
35457         LDKTxCreationKeys orig_conv;
35458         orig_conv.inner = untag_ptr(orig);
35459         orig_conv.is_owned = ptr_is_owned(orig);
35460         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35461         orig_conv.is_owned = false;
35462         LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
35463         uint64_t ret_ref = 0;
35464         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35465         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35466         return ret_ref;
35467 }
35468
35469 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_write"))) TS_TxCreationKeys_write(uint64_t obj) {
35470         LDKTxCreationKeys obj_conv;
35471         obj_conv.inner = untag_ptr(obj);
35472         obj_conv.is_owned = ptr_is_owned(obj);
35473         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35474         obj_conv.is_owned = false;
35475         LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
35476         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35477         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35478         CVec_u8Z_free(ret_var);
35479         return ret_arr;
35480 }
35481
35482 uint64_t  __attribute__((export_name("TS_TxCreationKeys_read"))) TS_TxCreationKeys_read(int8_tArray ser) {
35483         LDKu8slice ser_ref;
35484         ser_ref.datalen = ser->arr_len;
35485         ser_ref.data = ser->elems;
35486         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
35487         *ret_conv = TxCreationKeys_read(ser_ref);
35488         FREE(ser);
35489         return tag_ptr(ret_conv, true);
35490 }
35491
35492 void  __attribute__((export_name("TS_ChannelPublicKeys_free"))) TS_ChannelPublicKeys_free(uint64_t this_obj) {
35493         LDKChannelPublicKeys this_obj_conv;
35494         this_obj_conv.inner = untag_ptr(this_obj);
35495         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35497         ChannelPublicKeys_free(this_obj_conv);
35498 }
35499
35500 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_funding_pubkey"))) TS_ChannelPublicKeys_get_funding_pubkey(uint64_t this_ptr) {
35501         LDKChannelPublicKeys this_ptr_conv;
35502         this_ptr_conv.inner = untag_ptr(this_ptr);
35503         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35505         this_ptr_conv.is_owned = false;
35506         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35507         memcpy(ret_arr->elems, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
35508         return ret_arr;
35509 }
35510
35511 void  __attribute__((export_name("TS_ChannelPublicKeys_set_funding_pubkey"))) TS_ChannelPublicKeys_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
35512         LDKChannelPublicKeys this_ptr_conv;
35513         this_ptr_conv.inner = untag_ptr(this_ptr);
35514         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35516         this_ptr_conv.is_owned = false;
35517         LDKPublicKey val_ref;
35518         CHECK(val->arr_len == 33);
35519         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
35520         ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
35521 }
35522
35523 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_revocation_basepoint"))) TS_ChannelPublicKeys_get_revocation_basepoint(uint64_t this_ptr) {
35524         LDKChannelPublicKeys this_ptr_conv;
35525         this_ptr_conv.inner = untag_ptr(this_ptr);
35526         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35528         this_ptr_conv.is_owned = false;
35529         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35530         memcpy(ret_arr->elems, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
35531         return ret_arr;
35532 }
35533
35534 void  __attribute__((export_name("TS_ChannelPublicKeys_set_revocation_basepoint"))) TS_ChannelPublicKeys_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
35535         LDKChannelPublicKeys this_ptr_conv;
35536         this_ptr_conv.inner = untag_ptr(this_ptr);
35537         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35538         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35539         this_ptr_conv.is_owned = false;
35540         LDKPublicKey val_ref;
35541         CHECK(val->arr_len == 33);
35542         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
35543         ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
35544 }
35545
35546 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_payment_point"))) TS_ChannelPublicKeys_get_payment_point(uint64_t this_ptr) {
35547         LDKChannelPublicKeys this_ptr_conv;
35548         this_ptr_conv.inner = untag_ptr(this_ptr);
35549         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35551         this_ptr_conv.is_owned = false;
35552         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35553         memcpy(ret_arr->elems, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33);
35554         return ret_arr;
35555 }
35556
35557 void  __attribute__((export_name("TS_ChannelPublicKeys_set_payment_point"))) TS_ChannelPublicKeys_set_payment_point(uint64_t this_ptr, int8_tArray val) {
35558         LDKChannelPublicKeys this_ptr_conv;
35559         this_ptr_conv.inner = untag_ptr(this_ptr);
35560         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35562         this_ptr_conv.is_owned = false;
35563         LDKPublicKey val_ref;
35564         CHECK(val->arr_len == 33);
35565         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
35566         ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
35567 }
35568
35569 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_delayed_payment_basepoint"))) TS_ChannelPublicKeys_get_delayed_payment_basepoint(uint64_t this_ptr) {
35570         LDKChannelPublicKeys this_ptr_conv;
35571         this_ptr_conv.inner = untag_ptr(this_ptr);
35572         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35574         this_ptr_conv.is_owned = false;
35575         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35576         memcpy(ret_arr->elems, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
35577         return ret_arr;
35578 }
35579
35580 void  __attribute__((export_name("TS_ChannelPublicKeys_set_delayed_payment_basepoint"))) TS_ChannelPublicKeys_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
35581         LDKChannelPublicKeys this_ptr_conv;
35582         this_ptr_conv.inner = untag_ptr(this_ptr);
35583         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35585         this_ptr_conv.is_owned = false;
35586         LDKPublicKey val_ref;
35587         CHECK(val->arr_len == 33);
35588         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
35589         ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
35590 }
35591
35592 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_htlc_basepoint"))) TS_ChannelPublicKeys_get_htlc_basepoint(uint64_t this_ptr) {
35593         LDKChannelPublicKeys this_ptr_conv;
35594         this_ptr_conv.inner = untag_ptr(this_ptr);
35595         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35597         this_ptr_conv.is_owned = false;
35598         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35599         memcpy(ret_arr->elems, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
35600         return ret_arr;
35601 }
35602
35603 void  __attribute__((export_name("TS_ChannelPublicKeys_set_htlc_basepoint"))) TS_ChannelPublicKeys_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
35604         LDKChannelPublicKeys this_ptr_conv;
35605         this_ptr_conv.inner = untag_ptr(this_ptr);
35606         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35608         this_ptr_conv.is_owned = false;
35609         LDKPublicKey val_ref;
35610         CHECK(val->arr_len == 33);
35611         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
35612         ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
35613 }
35614
35615 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) {
35616         LDKPublicKey funding_pubkey_arg_ref;
35617         CHECK(funding_pubkey_arg->arr_len == 33);
35618         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
35619         LDKPublicKey revocation_basepoint_arg_ref;
35620         CHECK(revocation_basepoint_arg->arr_len == 33);
35621         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
35622         LDKPublicKey payment_point_arg_ref;
35623         CHECK(payment_point_arg->arr_len == 33);
35624         memcpy(payment_point_arg_ref.compressed_form, payment_point_arg->elems, 33); FREE(payment_point_arg);
35625         LDKPublicKey delayed_payment_basepoint_arg_ref;
35626         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
35627         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
35628         LDKPublicKey htlc_basepoint_arg_ref;
35629         CHECK(htlc_basepoint_arg->arr_len == 33);
35630         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
35631         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);
35632         uint64_t ret_ref = 0;
35633         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35634         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35635         return ret_ref;
35636 }
35637
35638 static inline uint64_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
35639         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
35640         uint64_t ret_ref = 0;
35641         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35642         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35643         return ret_ref;
35644 }
35645 int64_t  __attribute__((export_name("TS_ChannelPublicKeys_clone_ptr"))) TS_ChannelPublicKeys_clone_ptr(uint64_t arg) {
35646         LDKChannelPublicKeys arg_conv;
35647         arg_conv.inner = untag_ptr(arg);
35648         arg_conv.is_owned = ptr_is_owned(arg);
35649         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35650         arg_conv.is_owned = false;
35651         int64_t ret_conv = ChannelPublicKeys_clone_ptr(&arg_conv);
35652         return ret_conv;
35653 }
35654
35655 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_clone"))) TS_ChannelPublicKeys_clone(uint64_t orig) {
35656         LDKChannelPublicKeys orig_conv;
35657         orig_conv.inner = untag_ptr(orig);
35658         orig_conv.is_owned = ptr_is_owned(orig);
35659         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35660         orig_conv.is_owned = false;
35661         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
35662         uint64_t ret_ref = 0;
35663         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35664         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35665         return ret_ref;
35666 }
35667
35668 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_write"))) TS_ChannelPublicKeys_write(uint64_t obj) {
35669         LDKChannelPublicKeys obj_conv;
35670         obj_conv.inner = untag_ptr(obj);
35671         obj_conv.is_owned = ptr_is_owned(obj);
35672         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35673         obj_conv.is_owned = false;
35674         LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
35675         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35676         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35677         CVec_u8Z_free(ret_var);
35678         return ret_arr;
35679 }
35680
35681 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_read"))) TS_ChannelPublicKeys_read(int8_tArray ser) {
35682         LDKu8slice ser_ref;
35683         ser_ref.datalen = ser->arr_len;
35684         ser_ref.data = ser->elems;
35685         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
35686         *ret_conv = ChannelPublicKeys_read(ser_ref);
35687         FREE(ser);
35688         return tag_ptr(ret_conv, true);
35689 }
35690
35691 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) {
35692         LDKPublicKey per_commitment_point_ref;
35693         CHECK(per_commitment_point->arr_len == 33);
35694         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
35695         LDKPublicKey broadcaster_delayed_payment_base_ref;
35696         CHECK(broadcaster_delayed_payment_base->arr_len == 33);
35697         memcpy(broadcaster_delayed_payment_base_ref.compressed_form, broadcaster_delayed_payment_base->elems, 33); FREE(broadcaster_delayed_payment_base);
35698         LDKPublicKey broadcaster_htlc_base_ref;
35699         CHECK(broadcaster_htlc_base->arr_len == 33);
35700         memcpy(broadcaster_htlc_base_ref.compressed_form, broadcaster_htlc_base->elems, 33); FREE(broadcaster_htlc_base);
35701         LDKPublicKey countersignatory_revocation_base_ref;
35702         CHECK(countersignatory_revocation_base->arr_len == 33);
35703         memcpy(countersignatory_revocation_base_ref.compressed_form, countersignatory_revocation_base->elems, 33); FREE(countersignatory_revocation_base);
35704         LDKPublicKey countersignatory_htlc_base_ref;
35705         CHECK(countersignatory_htlc_base->arr_len == 33);
35706         memcpy(countersignatory_htlc_base_ref.compressed_form, countersignatory_htlc_base->elems, 33); FREE(countersignatory_htlc_base);
35707         LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
35708         *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);
35709         return tag_ptr(ret_conv, true);
35710 }
35711
35712 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) {
35713         LDKPublicKey per_commitment_point_ref;
35714         CHECK(per_commitment_point->arr_len == 33);
35715         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
35716         LDKChannelPublicKeys broadcaster_keys_conv;
35717         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
35718         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
35719         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
35720         broadcaster_keys_conv.is_owned = false;
35721         LDKChannelPublicKeys countersignatory_keys_conv;
35722         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
35723         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
35724         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
35725         countersignatory_keys_conv.is_owned = false;
35726         LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
35727         *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
35728         return tag_ptr(ret_conv, true);
35729 }
35730
35731 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) {
35732         LDKPublicKey revocation_key_ref;
35733         CHECK(revocation_key->arr_len == 33);
35734         memcpy(revocation_key_ref.compressed_form, revocation_key->elems, 33); FREE(revocation_key);
35735         LDKPublicKey broadcaster_delayed_payment_key_ref;
35736         CHECK(broadcaster_delayed_payment_key->arr_len == 33);
35737         memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key->elems, 33); FREE(broadcaster_delayed_payment_key);
35738         LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
35739         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35740         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35741         CVec_u8Z_free(ret_var);
35742         return ret_arr;
35743 }
35744
35745 void  __attribute__((export_name("TS_HTLCOutputInCommitment_free"))) TS_HTLCOutputInCommitment_free(uint64_t this_obj) {
35746         LDKHTLCOutputInCommitment this_obj_conv;
35747         this_obj_conv.inner = untag_ptr(this_obj);
35748         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35750         HTLCOutputInCommitment_free(this_obj_conv);
35751 }
35752
35753 jboolean  __attribute__((export_name("TS_HTLCOutputInCommitment_get_offered"))) TS_HTLCOutputInCommitment_get_offered(uint64_t this_ptr) {
35754         LDKHTLCOutputInCommitment this_ptr_conv;
35755         this_ptr_conv.inner = untag_ptr(this_ptr);
35756         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35758         this_ptr_conv.is_owned = false;
35759         jboolean ret_conv = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
35760         return ret_conv;
35761 }
35762
35763 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_offered"))) TS_HTLCOutputInCommitment_set_offered(uint64_t this_ptr, jboolean val) {
35764         LDKHTLCOutputInCommitment this_ptr_conv;
35765         this_ptr_conv.inner = untag_ptr(this_ptr);
35766         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35768         this_ptr_conv.is_owned = false;
35769         HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
35770 }
35771
35772 int64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_amount_msat"))) TS_HTLCOutputInCommitment_get_amount_msat(uint64_t this_ptr) {
35773         LDKHTLCOutputInCommitment this_ptr_conv;
35774         this_ptr_conv.inner = untag_ptr(this_ptr);
35775         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35776         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35777         this_ptr_conv.is_owned = false;
35778         int64_t ret_conv = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
35779         return ret_conv;
35780 }
35781
35782 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_amount_msat"))) TS_HTLCOutputInCommitment_set_amount_msat(uint64_t this_ptr, int64_t val) {
35783         LDKHTLCOutputInCommitment this_ptr_conv;
35784         this_ptr_conv.inner = untag_ptr(this_ptr);
35785         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35787         this_ptr_conv.is_owned = false;
35788         HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
35789 }
35790
35791 int32_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_cltv_expiry"))) TS_HTLCOutputInCommitment_get_cltv_expiry(uint64_t this_ptr) {
35792         LDKHTLCOutputInCommitment this_ptr_conv;
35793         this_ptr_conv.inner = untag_ptr(this_ptr);
35794         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35796         this_ptr_conv.is_owned = false;
35797         int32_t ret_conv = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
35798         return ret_conv;
35799 }
35800
35801 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_cltv_expiry"))) TS_HTLCOutputInCommitment_set_cltv_expiry(uint64_t this_ptr, int32_t val) {
35802         LDKHTLCOutputInCommitment this_ptr_conv;
35803         this_ptr_conv.inner = untag_ptr(this_ptr);
35804         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35806         this_ptr_conv.is_owned = false;
35807         HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
35808 }
35809
35810 int8_tArray  __attribute__((export_name("TS_HTLCOutputInCommitment_get_payment_hash"))) TS_HTLCOutputInCommitment_get_payment_hash(uint64_t this_ptr) {
35811         LDKHTLCOutputInCommitment this_ptr_conv;
35812         this_ptr_conv.inner = untag_ptr(this_ptr);
35813         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35815         this_ptr_conv.is_owned = false;
35816         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35817         memcpy(ret_arr->elems, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv), 32);
35818         return ret_arr;
35819 }
35820
35821 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_payment_hash"))) TS_HTLCOutputInCommitment_set_payment_hash(uint64_t this_ptr, int8_tArray val) {
35822         LDKHTLCOutputInCommitment this_ptr_conv;
35823         this_ptr_conv.inner = untag_ptr(this_ptr);
35824         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35826         this_ptr_conv.is_owned = false;
35827         LDKThirtyTwoBytes val_ref;
35828         CHECK(val->arr_len == 32);
35829         memcpy(val_ref.data, val->elems, 32); FREE(val);
35830         HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
35831 }
35832
35833 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_transaction_output_index"))) TS_HTLCOutputInCommitment_get_transaction_output_index(uint64_t this_ptr) {
35834         LDKHTLCOutputInCommitment this_ptr_conv;
35835         this_ptr_conv.inner = untag_ptr(this_ptr);
35836         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35838         this_ptr_conv.is_owned = false;
35839         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
35840         *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
35841         uint64_t ret_ref = tag_ptr(ret_copy, true);
35842         return ret_ref;
35843 }
35844
35845 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_transaction_output_index"))) TS_HTLCOutputInCommitment_set_transaction_output_index(uint64_t this_ptr, uint64_t val) {
35846         LDKHTLCOutputInCommitment this_ptr_conv;
35847         this_ptr_conv.inner = untag_ptr(this_ptr);
35848         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35850         this_ptr_conv.is_owned = false;
35851         void* val_ptr = untag_ptr(val);
35852         CHECK_ACCESS(val_ptr);
35853         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
35854         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
35855         HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
35856 }
35857
35858 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) {
35859         LDKThirtyTwoBytes payment_hash_arg_ref;
35860         CHECK(payment_hash_arg->arr_len == 32);
35861         memcpy(payment_hash_arg_ref.data, payment_hash_arg->elems, 32); FREE(payment_hash_arg);
35862         void* transaction_output_index_arg_ptr = untag_ptr(transaction_output_index_arg);
35863         CHECK_ACCESS(transaction_output_index_arg_ptr);
35864         LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
35865         transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(transaction_output_index_arg));
35866         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
35867         uint64_t ret_ref = 0;
35868         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35869         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35870         return ret_ref;
35871 }
35872
35873 static inline uint64_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
35874         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
35875         uint64_t ret_ref = 0;
35876         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35877         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35878         return ret_ref;
35879 }
35880 int64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_clone_ptr"))) TS_HTLCOutputInCommitment_clone_ptr(uint64_t arg) {
35881         LDKHTLCOutputInCommitment arg_conv;
35882         arg_conv.inner = untag_ptr(arg);
35883         arg_conv.is_owned = ptr_is_owned(arg);
35884         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35885         arg_conv.is_owned = false;
35886         int64_t ret_conv = HTLCOutputInCommitment_clone_ptr(&arg_conv);
35887         return ret_conv;
35888 }
35889
35890 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_clone"))) TS_HTLCOutputInCommitment_clone(uint64_t orig) {
35891         LDKHTLCOutputInCommitment orig_conv;
35892         orig_conv.inner = untag_ptr(orig);
35893         orig_conv.is_owned = ptr_is_owned(orig);
35894         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35895         orig_conv.is_owned = false;
35896         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
35897         uint64_t ret_ref = 0;
35898         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35899         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35900         return ret_ref;
35901 }
35902
35903 int8_tArray  __attribute__((export_name("TS_HTLCOutputInCommitment_write"))) TS_HTLCOutputInCommitment_write(uint64_t obj) {
35904         LDKHTLCOutputInCommitment obj_conv;
35905         obj_conv.inner = untag_ptr(obj);
35906         obj_conv.is_owned = ptr_is_owned(obj);
35907         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35908         obj_conv.is_owned = false;
35909         LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
35910         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35911         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35912         CVec_u8Z_free(ret_var);
35913         return ret_arr;
35914 }
35915
35916 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_read"))) TS_HTLCOutputInCommitment_read(int8_tArray ser) {
35917         LDKu8slice ser_ref;
35918         ser_ref.datalen = ser->arr_len;
35919         ser_ref.data = ser->elems;
35920         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
35921         *ret_conv = HTLCOutputInCommitment_read(ser_ref);
35922         FREE(ser);
35923         return tag_ptr(ret_conv, true);
35924 }
35925
35926 int8_tArray  __attribute__((export_name("TS_get_htlc_redeemscript"))) TS_get_htlc_redeemscript(uint64_t htlc, jboolean opt_anchors, uint64_t keys) {
35927         LDKHTLCOutputInCommitment htlc_conv;
35928         htlc_conv.inner = untag_ptr(htlc);
35929         htlc_conv.is_owned = ptr_is_owned(htlc);
35930         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
35931         htlc_conv.is_owned = false;
35932         LDKTxCreationKeys keys_conv;
35933         keys_conv.inner = untag_ptr(keys);
35934         keys_conv.is_owned = ptr_is_owned(keys);
35935         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
35936         keys_conv.is_owned = false;
35937         LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, opt_anchors, &keys_conv);
35938         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35939         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35940         CVec_u8Z_free(ret_var);
35941         return ret_arr;
35942 }
35943
35944 int8_tArray  __attribute__((export_name("TS_make_funding_redeemscript"))) TS_make_funding_redeemscript(int8_tArray broadcaster, int8_tArray countersignatory) {
35945         LDKPublicKey broadcaster_ref;
35946         CHECK(broadcaster->arr_len == 33);
35947         memcpy(broadcaster_ref.compressed_form, broadcaster->elems, 33); FREE(broadcaster);
35948         LDKPublicKey countersignatory_ref;
35949         CHECK(countersignatory->arr_len == 33);
35950         memcpy(countersignatory_ref.compressed_form, countersignatory->elems, 33); FREE(countersignatory);
35951         LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
35952         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35953         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35954         CVec_u8Z_free(ret_var);
35955         return ret_arr;
35956 }
35957
35958 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) {
35959         unsigned char commitment_txid_arr[32];
35960         CHECK(commitment_txid->arr_len == 32);
35961         memcpy(commitment_txid_arr, commitment_txid->elems, 32); FREE(commitment_txid);
35962         unsigned char (*commitment_txid_ref)[32] = &commitment_txid_arr;
35963         LDKHTLCOutputInCommitment htlc_conv;
35964         htlc_conv.inner = untag_ptr(htlc);
35965         htlc_conv.is_owned = ptr_is_owned(htlc);
35966         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
35967         htlc_conv.is_owned = false;
35968         LDKPublicKey broadcaster_delayed_payment_key_ref;
35969         CHECK(broadcaster_delayed_payment_key->arr_len == 33);
35970         memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key->elems, 33); FREE(broadcaster_delayed_payment_key);
35971         LDKPublicKey revocation_key_ref;
35972         CHECK(revocation_key->arr_len == 33);
35973         memcpy(revocation_key_ref.compressed_form, revocation_key->elems, 33); FREE(revocation_key);
35974         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);
35975         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35976         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35977         Transaction_free(ret_var);
35978         return ret_arr;
35979 }
35980
35981 int8_tArray  __attribute__((export_name("TS_get_anchor_redeemscript"))) TS_get_anchor_redeemscript(int8_tArray funding_pubkey) {
35982         LDKPublicKey funding_pubkey_ref;
35983         CHECK(funding_pubkey->arr_len == 33);
35984         memcpy(funding_pubkey_ref.compressed_form, funding_pubkey->elems, 33); FREE(funding_pubkey);
35985         LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
35986         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35987         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35988         CVec_u8Z_free(ret_var);
35989         return ret_arr;
35990 }
35991
35992 void  __attribute__((export_name("TS_ChannelTransactionParameters_free"))) TS_ChannelTransactionParameters_free(uint64_t this_obj) {
35993         LDKChannelTransactionParameters this_obj_conv;
35994         this_obj_conv.inner = untag_ptr(this_obj);
35995         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35997         ChannelTransactionParameters_free(this_obj_conv);
35998 }
35999
36000 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_pubkeys"))) TS_ChannelTransactionParameters_get_holder_pubkeys(uint64_t this_ptr) {
36001         LDKChannelTransactionParameters this_ptr_conv;
36002         this_ptr_conv.inner = untag_ptr(this_ptr);
36003         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36005         this_ptr_conv.is_owned = false;
36006         LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
36007         uint64_t ret_ref = 0;
36008         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36009         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36010         return ret_ref;
36011 }
36012
36013 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_holder_pubkeys"))) TS_ChannelTransactionParameters_set_holder_pubkeys(uint64_t this_ptr, uint64_t val) {
36014         LDKChannelTransactionParameters this_ptr_conv;
36015         this_ptr_conv.inner = untag_ptr(this_ptr);
36016         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36018         this_ptr_conv.is_owned = false;
36019         LDKChannelPublicKeys val_conv;
36020         val_conv.inner = untag_ptr(val);
36021         val_conv.is_owned = ptr_is_owned(val);
36022         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36023         val_conv = ChannelPublicKeys_clone(&val_conv);
36024         ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
36025 }
36026
36027 int16_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_selected_contest_delay"))) TS_ChannelTransactionParameters_get_holder_selected_contest_delay(uint64_t this_ptr) {
36028         LDKChannelTransactionParameters this_ptr_conv;
36029         this_ptr_conv.inner = untag_ptr(this_ptr);
36030         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36032         this_ptr_conv.is_owned = false;
36033         int16_t ret_conv = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
36034         return ret_conv;
36035 }
36036
36037 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) {
36038         LDKChannelTransactionParameters this_ptr_conv;
36039         this_ptr_conv.inner = untag_ptr(this_ptr);
36040         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36042         this_ptr_conv.is_owned = false;
36043         ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
36044 }
36045
36046 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_get_is_outbound_from_holder"))) TS_ChannelTransactionParameters_get_is_outbound_from_holder(uint64_t this_ptr) {
36047         LDKChannelTransactionParameters this_ptr_conv;
36048         this_ptr_conv.inner = untag_ptr(this_ptr);
36049         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36051         this_ptr_conv.is_owned = false;
36052         jboolean ret_conv = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
36053         return ret_conv;
36054 }
36055
36056 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_is_outbound_from_holder"))) TS_ChannelTransactionParameters_set_is_outbound_from_holder(uint64_t this_ptr, jboolean val) {
36057         LDKChannelTransactionParameters this_ptr_conv;
36058         this_ptr_conv.inner = untag_ptr(this_ptr);
36059         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36061         this_ptr_conv.is_owned = false;
36062         ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
36063 }
36064
36065 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_counterparty_parameters"))) TS_ChannelTransactionParameters_get_counterparty_parameters(uint64_t this_ptr) {
36066         LDKChannelTransactionParameters this_ptr_conv;
36067         this_ptr_conv.inner = untag_ptr(this_ptr);
36068         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36070         this_ptr_conv.is_owned = false;
36071         LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
36072         uint64_t ret_ref = 0;
36073         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36074         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36075         return ret_ref;
36076 }
36077
36078 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_counterparty_parameters"))) TS_ChannelTransactionParameters_set_counterparty_parameters(uint64_t this_ptr, uint64_t val) {
36079         LDKChannelTransactionParameters this_ptr_conv;
36080         this_ptr_conv.inner = untag_ptr(this_ptr);
36081         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36083         this_ptr_conv.is_owned = false;
36084         LDKCounterpartyChannelTransactionParameters val_conv;
36085         val_conv.inner = untag_ptr(val);
36086         val_conv.is_owned = ptr_is_owned(val);
36087         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36088         val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
36089         ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
36090 }
36091
36092 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_funding_outpoint"))) TS_ChannelTransactionParameters_get_funding_outpoint(uint64_t this_ptr) {
36093         LDKChannelTransactionParameters this_ptr_conv;
36094         this_ptr_conv.inner = untag_ptr(this_ptr);
36095         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36097         this_ptr_conv.is_owned = false;
36098         LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
36099         uint64_t ret_ref = 0;
36100         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36101         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36102         return ret_ref;
36103 }
36104
36105 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_funding_outpoint"))) TS_ChannelTransactionParameters_set_funding_outpoint(uint64_t this_ptr, uint64_t val) {
36106         LDKChannelTransactionParameters this_ptr_conv;
36107         this_ptr_conv.inner = untag_ptr(this_ptr);
36108         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36110         this_ptr_conv.is_owned = false;
36111         LDKOutPoint val_conv;
36112         val_conv.inner = untag_ptr(val);
36113         val_conv.is_owned = ptr_is_owned(val);
36114         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36115         val_conv = OutPoint_clone(&val_conv);
36116         ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
36117 }
36118
36119 uint32_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_opt_anchors"))) TS_ChannelTransactionParameters_get_opt_anchors(uint64_t this_ptr) {
36120         LDKChannelTransactionParameters this_ptr_conv;
36121         this_ptr_conv.inner = untag_ptr(this_ptr);
36122         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36124         this_ptr_conv.is_owned = false;
36125         uint32_t ret_conv = LDKCOption_NoneZ_to_js(ChannelTransactionParameters_get_opt_anchors(&this_ptr_conv));
36126         return ret_conv;
36127 }
36128
36129 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_opt_anchors"))) TS_ChannelTransactionParameters_set_opt_anchors(uint64_t this_ptr, uint32_t val) {
36130         LDKChannelTransactionParameters this_ptr_conv;
36131         this_ptr_conv.inner = untag_ptr(this_ptr);
36132         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36134         this_ptr_conv.is_owned = false;
36135         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_js(val);
36136         ChannelTransactionParameters_set_opt_anchors(&this_ptr_conv, val_conv);
36137 }
36138
36139 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) {
36140         LDKChannelPublicKeys holder_pubkeys_arg_conv;
36141         holder_pubkeys_arg_conv.inner = untag_ptr(holder_pubkeys_arg);
36142         holder_pubkeys_arg_conv.is_owned = ptr_is_owned(holder_pubkeys_arg);
36143         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
36144         holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
36145         LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
36146         counterparty_parameters_arg_conv.inner = untag_ptr(counterparty_parameters_arg);
36147         counterparty_parameters_arg_conv.is_owned = ptr_is_owned(counterparty_parameters_arg);
36148         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
36149         counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
36150         LDKOutPoint funding_outpoint_arg_conv;
36151         funding_outpoint_arg_conv.inner = untag_ptr(funding_outpoint_arg);
36152         funding_outpoint_arg_conv.is_owned = ptr_is_owned(funding_outpoint_arg);
36153         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
36154         funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
36155         LDKCOption_NoneZ opt_anchors_arg_conv = LDKCOption_NoneZ_from_js(opt_anchors_arg);
36156         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);
36157         uint64_t ret_ref = 0;
36158         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36159         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36160         return ret_ref;
36161 }
36162
36163 static inline uint64_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
36164         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
36165         uint64_t ret_ref = 0;
36166         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36167         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36168         return ret_ref;
36169 }
36170 int64_t  __attribute__((export_name("TS_ChannelTransactionParameters_clone_ptr"))) TS_ChannelTransactionParameters_clone_ptr(uint64_t arg) {
36171         LDKChannelTransactionParameters arg_conv;
36172         arg_conv.inner = untag_ptr(arg);
36173         arg_conv.is_owned = ptr_is_owned(arg);
36174         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36175         arg_conv.is_owned = false;
36176         int64_t ret_conv = ChannelTransactionParameters_clone_ptr(&arg_conv);
36177         return ret_conv;
36178 }
36179
36180 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_clone"))) TS_ChannelTransactionParameters_clone(uint64_t orig) {
36181         LDKChannelTransactionParameters orig_conv;
36182         orig_conv.inner = untag_ptr(orig);
36183         orig_conv.is_owned = ptr_is_owned(orig);
36184         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36185         orig_conv.is_owned = false;
36186         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
36187         uint64_t ret_ref = 0;
36188         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36189         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36190         return ret_ref;
36191 }
36192
36193 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_free"))) TS_CounterpartyChannelTransactionParameters_free(uint64_t this_obj) {
36194         LDKCounterpartyChannelTransactionParameters this_obj_conv;
36195         this_obj_conv.inner = untag_ptr(this_obj);
36196         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36198         CounterpartyChannelTransactionParameters_free(this_obj_conv);
36199 }
36200
36201 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_pubkeys"))) TS_CounterpartyChannelTransactionParameters_get_pubkeys(uint64_t this_ptr) {
36202         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
36203         this_ptr_conv.inner = untag_ptr(this_ptr);
36204         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36206         this_ptr_conv.is_owned = false;
36207         LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
36208         uint64_t ret_ref = 0;
36209         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36210         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36211         return ret_ref;
36212 }
36213
36214 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_pubkeys"))) TS_CounterpartyChannelTransactionParameters_set_pubkeys(uint64_t this_ptr, uint64_t val) {
36215         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
36216         this_ptr_conv.inner = untag_ptr(this_ptr);
36217         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36219         this_ptr_conv.is_owned = false;
36220         LDKChannelPublicKeys val_conv;
36221         val_conv.inner = untag_ptr(val);
36222         val_conv.is_owned = ptr_is_owned(val);
36223         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36224         val_conv = ChannelPublicKeys_clone(&val_conv);
36225         CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
36226 }
36227
36228 int16_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay(uint64_t this_ptr) {
36229         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
36230         this_ptr_conv.inner = untag_ptr(this_ptr);
36231         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36233         this_ptr_conv.is_owned = false;
36234         int16_t ret_conv = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
36235         return ret_conv;
36236 }
36237
36238 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay(uint64_t this_ptr, int16_t val) {
36239         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
36240         this_ptr_conv.inner = untag_ptr(this_ptr);
36241         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36243         this_ptr_conv.is_owned = false;
36244         CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
36245 }
36246
36247 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_new"))) TS_CounterpartyChannelTransactionParameters_new(uint64_t pubkeys_arg, int16_t selected_contest_delay_arg) {
36248         LDKChannelPublicKeys pubkeys_arg_conv;
36249         pubkeys_arg_conv.inner = untag_ptr(pubkeys_arg);
36250         pubkeys_arg_conv.is_owned = ptr_is_owned(pubkeys_arg);
36251         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
36252         pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
36253         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
36254         uint64_t ret_ref = 0;
36255         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36256         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36257         return ret_ref;
36258 }
36259
36260 static inline uint64_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
36261         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
36262         uint64_t ret_ref = 0;
36263         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36264         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36265         return ret_ref;
36266 }
36267 int64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone_ptr"))) TS_CounterpartyChannelTransactionParameters_clone_ptr(uint64_t arg) {
36268         LDKCounterpartyChannelTransactionParameters arg_conv;
36269         arg_conv.inner = untag_ptr(arg);
36270         arg_conv.is_owned = ptr_is_owned(arg);
36271         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36272         arg_conv.is_owned = false;
36273         int64_t ret_conv = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
36274         return ret_conv;
36275 }
36276
36277 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone"))) TS_CounterpartyChannelTransactionParameters_clone(uint64_t orig) {
36278         LDKCounterpartyChannelTransactionParameters orig_conv;
36279         orig_conv.inner = untag_ptr(orig);
36280         orig_conv.is_owned = ptr_is_owned(orig);
36281         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36282         orig_conv.is_owned = false;
36283         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
36284         uint64_t ret_ref = 0;
36285         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36286         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36287         return ret_ref;
36288 }
36289
36290 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_is_populated"))) TS_ChannelTransactionParameters_is_populated(uint64_t this_arg) {
36291         LDKChannelTransactionParameters this_arg_conv;
36292         this_arg_conv.inner = untag_ptr(this_arg);
36293         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36295         this_arg_conv.is_owned = false;
36296         jboolean ret_conv = ChannelTransactionParameters_is_populated(&this_arg_conv);
36297         return ret_conv;
36298 }
36299
36300 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_as_holder_broadcastable"))) TS_ChannelTransactionParameters_as_holder_broadcastable(uint64_t this_arg) {
36301         LDKChannelTransactionParameters this_arg_conv;
36302         this_arg_conv.inner = untag_ptr(this_arg);
36303         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36305         this_arg_conv.is_owned = false;
36306         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
36307         uint64_t ret_ref = 0;
36308         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36309         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36310         return ret_ref;
36311 }
36312
36313 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_as_counterparty_broadcastable"))) TS_ChannelTransactionParameters_as_counterparty_broadcastable(uint64_t this_arg) {
36314         LDKChannelTransactionParameters this_arg_conv;
36315         this_arg_conv.inner = untag_ptr(this_arg);
36316         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36318         this_arg_conv.is_owned = false;
36319         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
36320         uint64_t ret_ref = 0;
36321         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36322         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36323         return ret_ref;
36324 }
36325
36326 int8_tArray  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_write"))) TS_CounterpartyChannelTransactionParameters_write(uint64_t obj) {
36327         LDKCounterpartyChannelTransactionParameters obj_conv;
36328         obj_conv.inner = untag_ptr(obj);
36329         obj_conv.is_owned = ptr_is_owned(obj);
36330         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36331         obj_conv.is_owned = false;
36332         LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
36333         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36334         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36335         CVec_u8Z_free(ret_var);
36336         return ret_arr;
36337 }
36338
36339 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_read"))) TS_CounterpartyChannelTransactionParameters_read(int8_tArray ser) {
36340         LDKu8slice ser_ref;
36341         ser_ref.datalen = ser->arr_len;
36342         ser_ref.data = ser->elems;
36343         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
36344         *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
36345         FREE(ser);
36346         return tag_ptr(ret_conv, true);
36347 }
36348
36349 int8_tArray  __attribute__((export_name("TS_ChannelTransactionParameters_write"))) TS_ChannelTransactionParameters_write(uint64_t obj) {
36350         LDKChannelTransactionParameters obj_conv;
36351         obj_conv.inner = untag_ptr(obj);
36352         obj_conv.is_owned = ptr_is_owned(obj);
36353         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36354         obj_conv.is_owned = false;
36355         LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
36356         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36357         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36358         CVec_u8Z_free(ret_var);
36359         return ret_arr;
36360 }
36361
36362 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_read"))) TS_ChannelTransactionParameters_read(int8_tArray ser) {
36363         LDKu8slice ser_ref;
36364         ser_ref.datalen = ser->arr_len;
36365         ser_ref.data = ser->elems;
36366         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
36367         *ret_conv = ChannelTransactionParameters_read(ser_ref);
36368         FREE(ser);
36369         return tag_ptr(ret_conv, true);
36370 }
36371
36372 void  __attribute__((export_name("TS_DirectedChannelTransactionParameters_free"))) TS_DirectedChannelTransactionParameters_free(uint64_t this_obj) {
36373         LDKDirectedChannelTransactionParameters this_obj_conv;
36374         this_obj_conv.inner = untag_ptr(this_obj);
36375         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36377         DirectedChannelTransactionParameters_free(this_obj_conv);
36378 }
36379
36380 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_broadcaster_pubkeys"))) TS_DirectedChannelTransactionParameters_broadcaster_pubkeys(uint64_t this_arg) {
36381         LDKDirectedChannelTransactionParameters this_arg_conv;
36382         this_arg_conv.inner = untag_ptr(this_arg);
36383         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36385         this_arg_conv.is_owned = false;
36386         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
36387         uint64_t ret_ref = 0;
36388         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36389         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36390         return ret_ref;
36391 }
36392
36393 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_countersignatory_pubkeys"))) TS_DirectedChannelTransactionParameters_countersignatory_pubkeys(uint64_t this_arg) {
36394         LDKDirectedChannelTransactionParameters this_arg_conv;
36395         this_arg_conv.inner = untag_ptr(this_arg);
36396         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36398         this_arg_conv.is_owned = false;
36399         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
36400         uint64_t ret_ref = 0;
36401         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36402         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36403         return ret_ref;
36404 }
36405
36406 int16_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_contest_delay"))) TS_DirectedChannelTransactionParameters_contest_delay(uint64_t this_arg) {
36407         LDKDirectedChannelTransactionParameters this_arg_conv;
36408         this_arg_conv.inner = untag_ptr(this_arg);
36409         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36411         this_arg_conv.is_owned = false;
36412         int16_t ret_conv = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
36413         return ret_conv;
36414 }
36415
36416 jboolean  __attribute__((export_name("TS_DirectedChannelTransactionParameters_is_outbound"))) TS_DirectedChannelTransactionParameters_is_outbound(uint64_t this_arg) {
36417         LDKDirectedChannelTransactionParameters this_arg_conv;
36418         this_arg_conv.inner = untag_ptr(this_arg);
36419         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36421         this_arg_conv.is_owned = false;
36422         jboolean ret_conv = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
36423         return ret_conv;
36424 }
36425
36426 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_funding_outpoint"))) TS_DirectedChannelTransactionParameters_funding_outpoint(uint64_t this_arg) {
36427         LDKDirectedChannelTransactionParameters this_arg_conv;
36428         this_arg_conv.inner = untag_ptr(this_arg);
36429         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36431         this_arg_conv.is_owned = false;
36432         LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
36433         uint64_t ret_ref = 0;
36434         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36435         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36436         return ret_ref;
36437 }
36438
36439 jboolean  __attribute__((export_name("TS_DirectedChannelTransactionParameters_opt_anchors"))) TS_DirectedChannelTransactionParameters_opt_anchors(uint64_t this_arg) {
36440         LDKDirectedChannelTransactionParameters this_arg_conv;
36441         this_arg_conv.inner = untag_ptr(this_arg);
36442         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36444         this_arg_conv.is_owned = false;
36445         jboolean ret_conv = DirectedChannelTransactionParameters_opt_anchors(&this_arg_conv);
36446         return ret_conv;
36447 }
36448
36449 void  __attribute__((export_name("TS_HolderCommitmentTransaction_free"))) TS_HolderCommitmentTransaction_free(uint64_t this_obj) {
36450         LDKHolderCommitmentTransaction this_obj_conv;
36451         this_obj_conv.inner = untag_ptr(this_obj);
36452         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36454         HolderCommitmentTransaction_free(this_obj_conv);
36455 }
36456
36457 int8_tArray  __attribute__((export_name("TS_HolderCommitmentTransaction_get_counterparty_sig"))) TS_HolderCommitmentTransaction_get_counterparty_sig(uint64_t this_ptr) {
36458         LDKHolderCommitmentTransaction this_ptr_conv;
36459         this_ptr_conv.inner = untag_ptr(this_ptr);
36460         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36462         this_ptr_conv.is_owned = false;
36463         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
36464         memcpy(ret_arr->elems, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
36465         return ret_arr;
36466 }
36467
36468 void  __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_sig"))) TS_HolderCommitmentTransaction_set_counterparty_sig(uint64_t this_ptr, int8_tArray val) {
36469         LDKHolderCommitmentTransaction this_ptr_conv;
36470         this_ptr_conv.inner = untag_ptr(this_ptr);
36471         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36473         this_ptr_conv.is_owned = false;
36474         LDKSignature val_ref;
36475         CHECK(val->arr_len == 64);
36476         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
36477         HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
36478 }
36479
36480 ptrArray  __attribute__((export_name("TS_HolderCommitmentTransaction_get_counterparty_htlc_sigs"))) TS_HolderCommitmentTransaction_get_counterparty_htlc_sigs(uint64_t this_ptr) {
36481         LDKHolderCommitmentTransaction this_ptr_conv;
36482         this_ptr_conv.inner = untag_ptr(this_ptr);
36483         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36485         this_ptr_conv.is_owned = false;
36486         LDKCVec_SignatureZ ret_var = HolderCommitmentTransaction_get_counterparty_htlc_sigs(&this_ptr_conv);
36487         ptrArray ret_arr = NULL;
36488         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
36489         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
36490         for (size_t m = 0; m < ret_var.datalen; m++) {
36491                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
36492                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
36493                 ret_arr_ptr[m] = ret_conv_12_arr;
36494         }
36495         
36496         FREE(ret_var.data);
36497         return ret_arr;
36498 }
36499
36500 void  __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs"))) TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs(uint64_t this_ptr, ptrArray val) {
36501         LDKHolderCommitmentTransaction this_ptr_conv;
36502         this_ptr_conv.inner = untag_ptr(this_ptr);
36503         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36505         this_ptr_conv.is_owned = false;
36506         LDKCVec_SignatureZ val_constr;
36507         val_constr.datalen = val->arr_len;
36508         if (val_constr.datalen > 0)
36509                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
36510         else
36511                 val_constr.data = NULL;
36512         int8_tArray* val_vals = (void*) val->elems;
36513         for (size_t m = 0; m < val_constr.datalen; m++) {
36514                 int8_tArray val_conv_12 = val_vals[m];
36515                 LDKSignature val_conv_12_ref;
36516                 CHECK(val_conv_12->arr_len == 64);
36517                 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64); FREE(val_conv_12);
36518                 val_constr.data[m] = val_conv_12_ref;
36519         }
36520         FREE(val);
36521         HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
36522 }
36523
36524 static inline uint64_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
36525         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
36526         uint64_t ret_ref = 0;
36527         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36528         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36529         return ret_ref;
36530 }
36531 int64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_clone_ptr"))) TS_HolderCommitmentTransaction_clone_ptr(uint64_t arg) {
36532         LDKHolderCommitmentTransaction arg_conv;
36533         arg_conv.inner = untag_ptr(arg);
36534         arg_conv.is_owned = ptr_is_owned(arg);
36535         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36536         arg_conv.is_owned = false;
36537         int64_t ret_conv = HolderCommitmentTransaction_clone_ptr(&arg_conv);
36538         return ret_conv;
36539 }
36540
36541 uint64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_clone"))) TS_HolderCommitmentTransaction_clone(uint64_t orig) {
36542         LDKHolderCommitmentTransaction orig_conv;
36543         orig_conv.inner = untag_ptr(orig);
36544         orig_conv.is_owned = ptr_is_owned(orig);
36545         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36546         orig_conv.is_owned = false;
36547         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
36548         uint64_t ret_ref = 0;
36549         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36550         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36551         return ret_ref;
36552 }
36553
36554 int8_tArray  __attribute__((export_name("TS_HolderCommitmentTransaction_write"))) TS_HolderCommitmentTransaction_write(uint64_t obj) {
36555         LDKHolderCommitmentTransaction obj_conv;
36556         obj_conv.inner = untag_ptr(obj);
36557         obj_conv.is_owned = ptr_is_owned(obj);
36558         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36559         obj_conv.is_owned = false;
36560         LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
36561         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36562         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36563         CVec_u8Z_free(ret_var);
36564         return ret_arr;
36565 }
36566
36567 uint64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_read"))) TS_HolderCommitmentTransaction_read(int8_tArray ser) {
36568         LDKu8slice ser_ref;
36569         ser_ref.datalen = ser->arr_len;
36570         ser_ref.data = ser->elems;
36571         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
36572         *ret_conv = HolderCommitmentTransaction_read(ser_ref);
36573         FREE(ser);
36574         return tag_ptr(ret_conv, true);
36575 }
36576
36577 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) {
36578         LDKCommitmentTransaction commitment_tx_conv;
36579         commitment_tx_conv.inner = untag_ptr(commitment_tx);
36580         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
36581         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
36582         commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
36583         LDKSignature counterparty_sig_ref;
36584         CHECK(counterparty_sig->arr_len == 64);
36585         memcpy(counterparty_sig_ref.compact_form, counterparty_sig->elems, 64); FREE(counterparty_sig);
36586         LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
36587         counterparty_htlc_sigs_constr.datalen = counterparty_htlc_sigs->arr_len;
36588         if (counterparty_htlc_sigs_constr.datalen > 0)
36589                 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
36590         else
36591                 counterparty_htlc_sigs_constr.data = NULL;
36592         int8_tArray* counterparty_htlc_sigs_vals = (void*) counterparty_htlc_sigs->elems;
36593         for (size_t m = 0; m < counterparty_htlc_sigs_constr.datalen; m++) {
36594                 int8_tArray counterparty_htlc_sigs_conv_12 = counterparty_htlc_sigs_vals[m];
36595                 LDKSignature counterparty_htlc_sigs_conv_12_ref;
36596                 CHECK(counterparty_htlc_sigs_conv_12->arr_len == 64);
36597                 memcpy(counterparty_htlc_sigs_conv_12_ref.compact_form, counterparty_htlc_sigs_conv_12->elems, 64); FREE(counterparty_htlc_sigs_conv_12);
36598                 counterparty_htlc_sigs_constr.data[m] = counterparty_htlc_sigs_conv_12_ref;
36599         }
36600         FREE(counterparty_htlc_sigs);
36601         LDKPublicKey holder_funding_key_ref;
36602         CHECK(holder_funding_key->arr_len == 33);
36603         memcpy(holder_funding_key_ref.compressed_form, holder_funding_key->elems, 33); FREE(holder_funding_key);
36604         LDKPublicKey counterparty_funding_key_ref;
36605         CHECK(counterparty_funding_key->arr_len == 33);
36606         memcpy(counterparty_funding_key_ref.compressed_form, counterparty_funding_key->elems, 33); FREE(counterparty_funding_key);
36607         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
36608         uint64_t ret_ref = 0;
36609         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36610         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36611         return ret_ref;
36612 }
36613
36614 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_free"))) TS_BuiltCommitmentTransaction_free(uint64_t this_obj) {
36615         LDKBuiltCommitmentTransaction this_obj_conv;
36616         this_obj_conv.inner = untag_ptr(this_obj);
36617         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36618         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36619         BuiltCommitmentTransaction_free(this_obj_conv);
36620 }
36621
36622 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_get_transaction"))) TS_BuiltCommitmentTransaction_get_transaction(uint64_t this_ptr) {
36623         LDKBuiltCommitmentTransaction this_ptr_conv;
36624         this_ptr_conv.inner = untag_ptr(this_ptr);
36625         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36627         this_ptr_conv.is_owned = false;
36628         LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
36629         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36630         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36631         Transaction_free(ret_var);
36632         return ret_arr;
36633 }
36634
36635 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_set_transaction"))) TS_BuiltCommitmentTransaction_set_transaction(uint64_t this_ptr, int8_tArray val) {
36636         LDKBuiltCommitmentTransaction this_ptr_conv;
36637         this_ptr_conv.inner = untag_ptr(this_ptr);
36638         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36640         this_ptr_conv.is_owned = false;
36641         LDKTransaction val_ref;
36642         val_ref.datalen = val->arr_len;
36643         val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
36644         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
36645         val_ref.data_is_owned = true;
36646         BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
36647 }
36648
36649 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_get_txid"))) TS_BuiltCommitmentTransaction_get_txid(uint64_t this_ptr) {
36650         LDKBuiltCommitmentTransaction this_ptr_conv;
36651         this_ptr_conv.inner = untag_ptr(this_ptr);
36652         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36654         this_ptr_conv.is_owned = false;
36655         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
36656         memcpy(ret_arr->elems, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv), 32);
36657         return ret_arr;
36658 }
36659
36660 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_set_txid"))) TS_BuiltCommitmentTransaction_set_txid(uint64_t this_ptr, int8_tArray val) {
36661         LDKBuiltCommitmentTransaction this_ptr_conv;
36662         this_ptr_conv.inner = untag_ptr(this_ptr);
36663         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36665         this_ptr_conv.is_owned = false;
36666         LDKThirtyTwoBytes val_ref;
36667         CHECK(val->arr_len == 32);
36668         memcpy(val_ref.data, val->elems, 32); FREE(val);
36669         BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
36670 }
36671
36672 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_new"))) TS_BuiltCommitmentTransaction_new(int8_tArray transaction_arg, int8_tArray txid_arg) {
36673         LDKTransaction transaction_arg_ref;
36674         transaction_arg_ref.datalen = transaction_arg->arr_len;
36675         transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
36676         memcpy(transaction_arg_ref.data, transaction_arg->elems, transaction_arg_ref.datalen); FREE(transaction_arg);
36677         transaction_arg_ref.data_is_owned = true;
36678         LDKThirtyTwoBytes txid_arg_ref;
36679         CHECK(txid_arg->arr_len == 32);
36680         memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
36681         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
36682         uint64_t ret_ref = 0;
36683         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36684         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36685         return ret_ref;
36686 }
36687
36688 static inline uint64_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
36689         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
36690         uint64_t ret_ref = 0;
36691         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36692         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36693         return ret_ref;
36694 }
36695 int64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_clone_ptr"))) TS_BuiltCommitmentTransaction_clone_ptr(uint64_t arg) {
36696         LDKBuiltCommitmentTransaction arg_conv;
36697         arg_conv.inner = untag_ptr(arg);
36698         arg_conv.is_owned = ptr_is_owned(arg);
36699         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36700         arg_conv.is_owned = false;
36701         int64_t ret_conv = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
36702         return ret_conv;
36703 }
36704
36705 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_clone"))) TS_BuiltCommitmentTransaction_clone(uint64_t orig) {
36706         LDKBuiltCommitmentTransaction orig_conv;
36707         orig_conv.inner = untag_ptr(orig);
36708         orig_conv.is_owned = ptr_is_owned(orig);
36709         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36710         orig_conv.is_owned = false;
36711         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
36712         uint64_t ret_ref = 0;
36713         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36714         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36715         return ret_ref;
36716 }
36717
36718 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_write"))) TS_BuiltCommitmentTransaction_write(uint64_t obj) {
36719         LDKBuiltCommitmentTransaction obj_conv;
36720         obj_conv.inner = untag_ptr(obj);
36721         obj_conv.is_owned = ptr_is_owned(obj);
36722         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36723         obj_conv.is_owned = false;
36724         LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
36725         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36726         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36727         CVec_u8Z_free(ret_var);
36728         return ret_arr;
36729 }
36730
36731 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_read"))) TS_BuiltCommitmentTransaction_read(int8_tArray ser) {
36732         LDKu8slice ser_ref;
36733         ser_ref.datalen = ser->arr_len;
36734         ser_ref.data = ser->elems;
36735         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
36736         *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
36737         FREE(ser);
36738         return tag_ptr(ret_conv, true);
36739 }
36740
36741 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) {
36742         LDKBuiltCommitmentTransaction this_arg_conv;
36743         this_arg_conv.inner = untag_ptr(this_arg);
36744         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36745         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36746         this_arg_conv.is_owned = false;
36747         LDKu8slice funding_redeemscript_ref;
36748         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
36749         funding_redeemscript_ref.data = funding_redeemscript->elems;
36750         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
36751         memcpy(ret_arr->elems, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
36752         FREE(funding_redeemscript);
36753         return ret_arr;
36754 }
36755
36756 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) {
36757         LDKBuiltCommitmentTransaction this_arg_conv;
36758         this_arg_conv.inner = untag_ptr(this_arg);
36759         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36761         this_arg_conv.is_owned = false;
36762         unsigned char funding_key_arr[32];
36763         CHECK(funding_key->arr_len == 32);
36764         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
36765         unsigned char (*funding_key_ref)[32] = &funding_key_arr;
36766         LDKu8slice funding_redeemscript_ref;
36767         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
36768         funding_redeemscript_ref.data = funding_redeemscript->elems;
36769         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
36770         memcpy(ret_arr->elems, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
36771         FREE(funding_redeemscript);
36772         return ret_arr;
36773 }
36774
36775 void  __attribute__((export_name("TS_ClosingTransaction_free"))) TS_ClosingTransaction_free(uint64_t this_obj) {
36776         LDKClosingTransaction this_obj_conv;
36777         this_obj_conv.inner = untag_ptr(this_obj);
36778         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36780         ClosingTransaction_free(this_obj_conv);
36781 }
36782
36783 static inline uint64_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
36784         LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
36785         uint64_t ret_ref = 0;
36786         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36787         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36788         return ret_ref;
36789 }
36790 int64_t  __attribute__((export_name("TS_ClosingTransaction_clone_ptr"))) TS_ClosingTransaction_clone_ptr(uint64_t arg) {
36791         LDKClosingTransaction arg_conv;
36792         arg_conv.inner = untag_ptr(arg);
36793         arg_conv.is_owned = ptr_is_owned(arg);
36794         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36795         arg_conv.is_owned = false;
36796         int64_t ret_conv = ClosingTransaction_clone_ptr(&arg_conv);
36797         return ret_conv;
36798 }
36799
36800 uint64_t  __attribute__((export_name("TS_ClosingTransaction_clone"))) TS_ClosingTransaction_clone(uint64_t orig) {
36801         LDKClosingTransaction orig_conv;
36802         orig_conv.inner = untag_ptr(orig);
36803         orig_conv.is_owned = ptr_is_owned(orig);
36804         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36805         orig_conv.is_owned = false;
36806         LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
36807         uint64_t ret_ref = 0;
36808         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36809         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36810         return ret_ref;
36811 }
36812
36813 int64_t  __attribute__((export_name("TS_ClosingTransaction_hash"))) TS_ClosingTransaction_hash(uint64_t o) {
36814         LDKClosingTransaction o_conv;
36815         o_conv.inner = untag_ptr(o);
36816         o_conv.is_owned = ptr_is_owned(o);
36817         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36818         o_conv.is_owned = false;
36819         int64_t ret_conv = ClosingTransaction_hash(&o_conv);
36820         return ret_conv;
36821 }
36822
36823 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) {
36824         LDKCVec_u8Z to_holder_script_ref;
36825         to_holder_script_ref.datalen = to_holder_script->arr_len;
36826         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
36827         memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
36828         LDKCVec_u8Z to_counterparty_script_ref;
36829         to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
36830         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
36831         memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
36832         LDKOutPoint funding_outpoint_conv;
36833         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
36834         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
36835         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
36836         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
36837         LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
36838         uint64_t ret_ref = 0;
36839         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36840         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36841         return ret_ref;
36842 }
36843
36844 uint64_t  __attribute__((export_name("TS_ClosingTransaction_trust"))) TS_ClosingTransaction_trust(uint64_t this_arg) {
36845         LDKClosingTransaction this_arg_conv;
36846         this_arg_conv.inner = untag_ptr(this_arg);
36847         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36849         this_arg_conv.is_owned = false;
36850         LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
36851         uint64_t ret_ref = 0;
36852         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36853         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36854         return ret_ref;
36855 }
36856
36857 uint64_t  __attribute__((export_name("TS_ClosingTransaction_verify"))) TS_ClosingTransaction_verify(uint64_t this_arg, uint64_t funding_outpoint) {
36858         LDKClosingTransaction this_arg_conv;
36859         this_arg_conv.inner = untag_ptr(this_arg);
36860         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36862         this_arg_conv.is_owned = false;
36863         LDKOutPoint funding_outpoint_conv;
36864         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
36865         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
36866         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
36867         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
36868         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
36869         *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
36870         return tag_ptr(ret_conv, true);
36871 }
36872
36873 int64_t  __attribute__((export_name("TS_ClosingTransaction_to_holder_value_sat"))) TS_ClosingTransaction_to_holder_value_sat(uint64_t this_arg) {
36874         LDKClosingTransaction this_arg_conv;
36875         this_arg_conv.inner = untag_ptr(this_arg);
36876         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36878         this_arg_conv.is_owned = false;
36879         int64_t ret_conv = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
36880         return ret_conv;
36881 }
36882
36883 int64_t  __attribute__((export_name("TS_ClosingTransaction_to_counterparty_value_sat"))) TS_ClosingTransaction_to_counterparty_value_sat(uint64_t this_arg) {
36884         LDKClosingTransaction this_arg_conv;
36885         this_arg_conv.inner = untag_ptr(this_arg);
36886         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36888         this_arg_conv.is_owned = false;
36889         int64_t ret_conv = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
36890         return ret_conv;
36891 }
36892
36893 int8_tArray  __attribute__((export_name("TS_ClosingTransaction_to_holder_script"))) TS_ClosingTransaction_to_holder_script(uint64_t this_arg) {
36894         LDKClosingTransaction this_arg_conv;
36895         this_arg_conv.inner = untag_ptr(this_arg);
36896         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36898         this_arg_conv.is_owned = false;
36899         LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
36900         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36901         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36902         return ret_arr;
36903 }
36904
36905 int8_tArray  __attribute__((export_name("TS_ClosingTransaction_to_counterparty_script"))) TS_ClosingTransaction_to_counterparty_script(uint64_t this_arg) {
36906         LDKClosingTransaction this_arg_conv;
36907         this_arg_conv.inner = untag_ptr(this_arg);
36908         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36910         this_arg_conv.is_owned = false;
36911         LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
36912         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36913         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36914         return ret_arr;
36915 }
36916
36917 void  __attribute__((export_name("TS_TrustedClosingTransaction_free"))) TS_TrustedClosingTransaction_free(uint64_t this_obj) {
36918         LDKTrustedClosingTransaction this_obj_conv;
36919         this_obj_conv.inner = untag_ptr(this_obj);
36920         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36922         TrustedClosingTransaction_free(this_obj_conv);
36923 }
36924
36925 int8_tArray  __attribute__((export_name("TS_TrustedClosingTransaction_built_transaction"))) TS_TrustedClosingTransaction_built_transaction(uint64_t this_arg) {
36926         LDKTrustedClosingTransaction this_arg_conv;
36927         this_arg_conv.inner = untag_ptr(this_arg);
36928         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36930         this_arg_conv.is_owned = false;
36931         LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
36932         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36933         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36934         Transaction_free(ret_var);
36935         return ret_arr;
36936 }
36937
36938 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) {
36939         LDKTrustedClosingTransaction this_arg_conv;
36940         this_arg_conv.inner = untag_ptr(this_arg);
36941         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36943         this_arg_conv.is_owned = false;
36944         LDKu8slice funding_redeemscript_ref;
36945         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
36946         funding_redeemscript_ref.data = funding_redeemscript->elems;
36947         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
36948         memcpy(ret_arr->elems, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
36949         FREE(funding_redeemscript);
36950         return ret_arr;
36951 }
36952
36953 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) {
36954         LDKTrustedClosingTransaction this_arg_conv;
36955         this_arg_conv.inner = untag_ptr(this_arg);
36956         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36958         this_arg_conv.is_owned = false;
36959         unsigned char funding_key_arr[32];
36960         CHECK(funding_key->arr_len == 32);
36961         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
36962         unsigned char (*funding_key_ref)[32] = &funding_key_arr;
36963         LDKu8slice funding_redeemscript_ref;
36964         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
36965         funding_redeemscript_ref.data = funding_redeemscript->elems;
36966         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
36967         memcpy(ret_arr->elems, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
36968         FREE(funding_redeemscript);
36969         return ret_arr;
36970 }
36971
36972 void  __attribute__((export_name("TS_CommitmentTransaction_free"))) TS_CommitmentTransaction_free(uint64_t this_obj) {
36973         LDKCommitmentTransaction this_obj_conv;
36974         this_obj_conv.inner = untag_ptr(this_obj);
36975         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36977         CommitmentTransaction_free(this_obj_conv);
36978 }
36979
36980 static inline uint64_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
36981         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
36982         uint64_t ret_ref = 0;
36983         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36984         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36985         return ret_ref;
36986 }
36987 int64_t  __attribute__((export_name("TS_CommitmentTransaction_clone_ptr"))) TS_CommitmentTransaction_clone_ptr(uint64_t arg) {
36988         LDKCommitmentTransaction arg_conv;
36989         arg_conv.inner = untag_ptr(arg);
36990         arg_conv.is_owned = ptr_is_owned(arg);
36991         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36992         arg_conv.is_owned = false;
36993         int64_t ret_conv = CommitmentTransaction_clone_ptr(&arg_conv);
36994         return ret_conv;
36995 }
36996
36997 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_clone"))) TS_CommitmentTransaction_clone(uint64_t orig) {
36998         LDKCommitmentTransaction orig_conv;
36999         orig_conv.inner = untag_ptr(orig);
37000         orig_conv.is_owned = ptr_is_owned(orig);
37001         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37002         orig_conv.is_owned = false;
37003         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
37004         uint64_t ret_ref = 0;
37005         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37006         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37007         return ret_ref;
37008 }
37009
37010 int8_tArray  __attribute__((export_name("TS_CommitmentTransaction_write"))) TS_CommitmentTransaction_write(uint64_t obj) {
37011         LDKCommitmentTransaction obj_conv;
37012         obj_conv.inner = untag_ptr(obj);
37013         obj_conv.is_owned = ptr_is_owned(obj);
37014         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37015         obj_conv.is_owned = false;
37016         LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
37017         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37018         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37019         CVec_u8Z_free(ret_var);
37020         return ret_arr;
37021 }
37022
37023 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_read"))) TS_CommitmentTransaction_read(int8_tArray ser) {
37024         LDKu8slice ser_ref;
37025         ser_ref.datalen = ser->arr_len;
37026         ser_ref.data = ser->elems;
37027         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
37028         *ret_conv = CommitmentTransaction_read(ser_ref);
37029         FREE(ser);
37030         return tag_ptr(ret_conv, true);
37031 }
37032
37033 int64_t  __attribute__((export_name("TS_CommitmentTransaction_commitment_number"))) TS_CommitmentTransaction_commitment_number(uint64_t this_arg) {
37034         LDKCommitmentTransaction this_arg_conv;
37035         this_arg_conv.inner = untag_ptr(this_arg);
37036         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37038         this_arg_conv.is_owned = false;
37039         int64_t ret_conv = CommitmentTransaction_commitment_number(&this_arg_conv);
37040         return ret_conv;
37041 }
37042
37043 int64_t  __attribute__((export_name("TS_CommitmentTransaction_to_broadcaster_value_sat"))) TS_CommitmentTransaction_to_broadcaster_value_sat(uint64_t this_arg) {
37044         LDKCommitmentTransaction this_arg_conv;
37045         this_arg_conv.inner = untag_ptr(this_arg);
37046         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37048         this_arg_conv.is_owned = false;
37049         int64_t ret_conv = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
37050         return ret_conv;
37051 }
37052
37053 int64_t  __attribute__((export_name("TS_CommitmentTransaction_to_countersignatory_value_sat"))) TS_CommitmentTransaction_to_countersignatory_value_sat(uint64_t this_arg) {
37054         LDKCommitmentTransaction this_arg_conv;
37055         this_arg_conv.inner = untag_ptr(this_arg);
37056         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37058         this_arg_conv.is_owned = false;
37059         int64_t ret_conv = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
37060         return ret_conv;
37061 }
37062
37063 int32_t  __attribute__((export_name("TS_CommitmentTransaction_feerate_per_kw"))) TS_CommitmentTransaction_feerate_per_kw(uint64_t this_arg) {
37064         LDKCommitmentTransaction this_arg_conv;
37065         this_arg_conv.inner = untag_ptr(this_arg);
37066         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37068         this_arg_conv.is_owned = false;
37069         int32_t ret_conv = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
37070         return ret_conv;
37071 }
37072
37073 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_trust"))) TS_CommitmentTransaction_trust(uint64_t this_arg) {
37074         LDKCommitmentTransaction this_arg_conv;
37075         this_arg_conv.inner = untag_ptr(this_arg);
37076         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37078         this_arg_conv.is_owned = false;
37079         LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
37080         uint64_t ret_ref = 0;
37081         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37082         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37083         return ret_ref;
37084 }
37085
37086 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) {
37087         LDKCommitmentTransaction this_arg_conv;
37088         this_arg_conv.inner = untag_ptr(this_arg);
37089         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37090         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37091         this_arg_conv.is_owned = false;
37092         LDKDirectedChannelTransactionParameters channel_parameters_conv;
37093         channel_parameters_conv.inner = untag_ptr(channel_parameters);
37094         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
37095         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
37096         channel_parameters_conv.is_owned = false;
37097         LDKChannelPublicKeys broadcaster_keys_conv;
37098         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
37099         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
37100         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
37101         broadcaster_keys_conv.is_owned = false;
37102         LDKChannelPublicKeys countersignatory_keys_conv;
37103         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
37104         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
37105         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
37106         countersignatory_keys_conv.is_owned = false;
37107         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
37108         *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
37109         return tag_ptr(ret_conv, true);
37110 }
37111
37112 void  __attribute__((export_name("TS_TrustedCommitmentTransaction_free"))) TS_TrustedCommitmentTransaction_free(uint64_t this_obj) {
37113         LDKTrustedCommitmentTransaction this_obj_conv;
37114         this_obj_conv.inner = untag_ptr(this_obj);
37115         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37117         TrustedCommitmentTransaction_free(this_obj_conv);
37118 }
37119
37120 int8_tArray  __attribute__((export_name("TS_TrustedCommitmentTransaction_txid"))) TS_TrustedCommitmentTransaction_txid(uint64_t this_arg) {
37121         LDKTrustedCommitmentTransaction this_arg_conv;
37122         this_arg_conv.inner = untag_ptr(this_arg);
37123         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37125         this_arg_conv.is_owned = false;
37126         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37127         memcpy(ret_arr->elems, TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32);
37128         return ret_arr;
37129 }
37130
37131 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_built_transaction"))) TS_TrustedCommitmentTransaction_built_transaction(uint64_t this_arg) {
37132         LDKTrustedCommitmentTransaction this_arg_conv;
37133         this_arg_conv.inner = untag_ptr(this_arg);
37134         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37135         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37136         this_arg_conv.is_owned = false;
37137         LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
37138         uint64_t ret_ref = 0;
37139         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37140         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37141         return ret_ref;
37142 }
37143
37144 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_keys"))) TS_TrustedCommitmentTransaction_keys(uint64_t this_arg) {
37145         LDKTrustedCommitmentTransaction this_arg_conv;
37146         this_arg_conv.inner = untag_ptr(this_arg);
37147         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37149         this_arg_conv.is_owned = false;
37150         LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
37151         uint64_t ret_ref = 0;
37152         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37153         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37154         return ret_ref;
37155 }
37156
37157 jboolean  __attribute__((export_name("TS_TrustedCommitmentTransaction_opt_anchors"))) TS_TrustedCommitmentTransaction_opt_anchors(uint64_t this_arg) {
37158         LDKTrustedCommitmentTransaction this_arg_conv;
37159         this_arg_conv.inner = untag_ptr(this_arg);
37160         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37162         this_arg_conv.is_owned = false;
37163         jboolean ret_conv = TrustedCommitmentTransaction_opt_anchors(&this_arg_conv);
37164         return ret_conv;
37165 }
37166
37167 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) {
37168         LDKTrustedCommitmentTransaction this_arg_conv;
37169         this_arg_conv.inner = untag_ptr(this_arg);
37170         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37172         this_arg_conv.is_owned = false;
37173         unsigned char htlc_base_key_arr[32];
37174         CHECK(htlc_base_key->arr_len == 32);
37175         memcpy(htlc_base_key_arr, htlc_base_key->elems, 32); FREE(htlc_base_key);
37176         unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
37177         LDKDirectedChannelTransactionParameters channel_parameters_conv;
37178         channel_parameters_conv.inner = untag_ptr(channel_parameters);
37179         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
37180         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
37181         channel_parameters_conv.is_owned = false;
37182         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
37183         *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
37184         return tag_ptr(ret_conv, true);
37185 }
37186
37187 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) {
37188         LDKPublicKey broadcaster_payment_basepoint_ref;
37189         CHECK(broadcaster_payment_basepoint->arr_len == 33);
37190         memcpy(broadcaster_payment_basepoint_ref.compressed_form, broadcaster_payment_basepoint->elems, 33); FREE(broadcaster_payment_basepoint);
37191         LDKPublicKey countersignatory_payment_basepoint_ref;
37192         CHECK(countersignatory_payment_basepoint->arr_len == 33);
37193         memcpy(countersignatory_payment_basepoint_ref.compressed_form, countersignatory_payment_basepoint->elems, 33); FREE(countersignatory_payment_basepoint);
37194         int64_t ret_conv = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
37195         return ret_conv;
37196 }
37197
37198 jboolean  __attribute__((export_name("TS_InitFeatures_eq"))) TS_InitFeatures_eq(uint64_t a, uint64_t b) {
37199         LDKInitFeatures a_conv;
37200         a_conv.inner = untag_ptr(a);
37201         a_conv.is_owned = ptr_is_owned(a);
37202         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37203         a_conv.is_owned = false;
37204         LDKInitFeatures b_conv;
37205         b_conv.inner = untag_ptr(b);
37206         b_conv.is_owned = ptr_is_owned(b);
37207         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37208         b_conv.is_owned = false;
37209         jboolean ret_conv = InitFeatures_eq(&a_conv, &b_conv);
37210         return ret_conv;
37211 }
37212
37213 jboolean  __attribute__((export_name("TS_NodeFeatures_eq"))) TS_NodeFeatures_eq(uint64_t a, uint64_t b) {
37214         LDKNodeFeatures a_conv;
37215         a_conv.inner = untag_ptr(a);
37216         a_conv.is_owned = ptr_is_owned(a);
37217         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37218         a_conv.is_owned = false;
37219         LDKNodeFeatures b_conv;
37220         b_conv.inner = untag_ptr(b);
37221         b_conv.is_owned = ptr_is_owned(b);
37222         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37223         b_conv.is_owned = false;
37224         jboolean ret_conv = NodeFeatures_eq(&a_conv, &b_conv);
37225         return ret_conv;
37226 }
37227
37228 jboolean  __attribute__((export_name("TS_ChannelFeatures_eq"))) TS_ChannelFeatures_eq(uint64_t a, uint64_t b) {
37229         LDKChannelFeatures a_conv;
37230         a_conv.inner = untag_ptr(a);
37231         a_conv.is_owned = ptr_is_owned(a);
37232         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37233         a_conv.is_owned = false;
37234         LDKChannelFeatures b_conv;
37235         b_conv.inner = untag_ptr(b);
37236         b_conv.is_owned = ptr_is_owned(b);
37237         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37238         b_conv.is_owned = false;
37239         jboolean ret_conv = ChannelFeatures_eq(&a_conv, &b_conv);
37240         return ret_conv;
37241 }
37242
37243 jboolean  __attribute__((export_name("TS_InvoiceFeatures_eq"))) TS_InvoiceFeatures_eq(uint64_t a, uint64_t b) {
37244         LDKInvoiceFeatures a_conv;
37245         a_conv.inner = untag_ptr(a);
37246         a_conv.is_owned = ptr_is_owned(a);
37247         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37248         a_conv.is_owned = false;
37249         LDKInvoiceFeatures b_conv;
37250         b_conv.inner = untag_ptr(b);
37251         b_conv.is_owned = ptr_is_owned(b);
37252         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37253         b_conv.is_owned = false;
37254         jboolean ret_conv = InvoiceFeatures_eq(&a_conv, &b_conv);
37255         return ret_conv;
37256 }
37257
37258 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_eq"))) TS_ChannelTypeFeatures_eq(uint64_t a, uint64_t b) {
37259         LDKChannelTypeFeatures a_conv;
37260         a_conv.inner = untag_ptr(a);
37261         a_conv.is_owned = ptr_is_owned(a);
37262         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37263         a_conv.is_owned = false;
37264         LDKChannelTypeFeatures b_conv;
37265         b_conv.inner = untag_ptr(b);
37266         b_conv.is_owned = ptr_is_owned(b);
37267         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37268         b_conv.is_owned = false;
37269         jboolean ret_conv = ChannelTypeFeatures_eq(&a_conv, &b_conv);
37270         return ret_conv;
37271 }
37272
37273 static inline uint64_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
37274         LDKInitFeatures ret_var = InitFeatures_clone(arg);
37275         uint64_t ret_ref = 0;
37276         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37277         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37278         return ret_ref;
37279 }
37280 int64_t  __attribute__((export_name("TS_InitFeatures_clone_ptr"))) TS_InitFeatures_clone_ptr(uint64_t arg) {
37281         LDKInitFeatures arg_conv;
37282         arg_conv.inner = untag_ptr(arg);
37283         arg_conv.is_owned = ptr_is_owned(arg);
37284         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37285         arg_conv.is_owned = false;
37286         int64_t ret_conv = InitFeatures_clone_ptr(&arg_conv);
37287         return ret_conv;
37288 }
37289
37290 uint64_t  __attribute__((export_name("TS_InitFeatures_clone"))) TS_InitFeatures_clone(uint64_t orig) {
37291         LDKInitFeatures orig_conv;
37292         orig_conv.inner = untag_ptr(orig);
37293         orig_conv.is_owned = ptr_is_owned(orig);
37294         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37295         orig_conv.is_owned = false;
37296         LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
37297         uint64_t ret_ref = 0;
37298         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37299         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37300         return ret_ref;
37301 }
37302
37303 static inline uint64_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
37304         LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
37305         uint64_t ret_ref = 0;
37306         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37307         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37308         return ret_ref;
37309 }
37310 int64_t  __attribute__((export_name("TS_NodeFeatures_clone_ptr"))) TS_NodeFeatures_clone_ptr(uint64_t arg) {
37311         LDKNodeFeatures arg_conv;
37312         arg_conv.inner = untag_ptr(arg);
37313         arg_conv.is_owned = ptr_is_owned(arg);
37314         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37315         arg_conv.is_owned = false;
37316         int64_t ret_conv = NodeFeatures_clone_ptr(&arg_conv);
37317         return ret_conv;
37318 }
37319
37320 uint64_t  __attribute__((export_name("TS_NodeFeatures_clone"))) TS_NodeFeatures_clone(uint64_t orig) {
37321         LDKNodeFeatures orig_conv;
37322         orig_conv.inner = untag_ptr(orig);
37323         orig_conv.is_owned = ptr_is_owned(orig);
37324         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37325         orig_conv.is_owned = false;
37326         LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
37327         uint64_t ret_ref = 0;
37328         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37329         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37330         return ret_ref;
37331 }
37332
37333 static inline uint64_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
37334         LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
37335         uint64_t ret_ref = 0;
37336         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37337         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37338         return ret_ref;
37339 }
37340 int64_t  __attribute__((export_name("TS_ChannelFeatures_clone_ptr"))) TS_ChannelFeatures_clone_ptr(uint64_t arg) {
37341         LDKChannelFeatures arg_conv;
37342         arg_conv.inner = untag_ptr(arg);
37343         arg_conv.is_owned = ptr_is_owned(arg);
37344         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37345         arg_conv.is_owned = false;
37346         int64_t ret_conv = ChannelFeatures_clone_ptr(&arg_conv);
37347         return ret_conv;
37348 }
37349
37350 uint64_t  __attribute__((export_name("TS_ChannelFeatures_clone"))) TS_ChannelFeatures_clone(uint64_t orig) {
37351         LDKChannelFeatures orig_conv;
37352         orig_conv.inner = untag_ptr(orig);
37353         orig_conv.is_owned = ptr_is_owned(orig);
37354         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37355         orig_conv.is_owned = false;
37356         LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
37357         uint64_t ret_ref = 0;
37358         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37359         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37360         return ret_ref;
37361 }
37362
37363 static inline uint64_t InvoiceFeatures_clone_ptr(LDKInvoiceFeatures *NONNULL_PTR arg) {
37364         LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(arg);
37365         uint64_t ret_ref = 0;
37366         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37367         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37368         return ret_ref;
37369 }
37370 int64_t  __attribute__((export_name("TS_InvoiceFeatures_clone_ptr"))) TS_InvoiceFeatures_clone_ptr(uint64_t arg) {
37371         LDKInvoiceFeatures arg_conv;
37372         arg_conv.inner = untag_ptr(arg);
37373         arg_conv.is_owned = ptr_is_owned(arg);
37374         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37375         arg_conv.is_owned = false;
37376         int64_t ret_conv = InvoiceFeatures_clone_ptr(&arg_conv);
37377         return ret_conv;
37378 }
37379
37380 uint64_t  __attribute__((export_name("TS_InvoiceFeatures_clone"))) TS_InvoiceFeatures_clone(uint64_t orig) {
37381         LDKInvoiceFeatures orig_conv;
37382         orig_conv.inner = untag_ptr(orig);
37383         orig_conv.is_owned = ptr_is_owned(orig);
37384         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37385         orig_conv.is_owned = false;
37386         LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
37387         uint64_t ret_ref = 0;
37388         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37389         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37390         return ret_ref;
37391 }
37392
37393 static inline uint64_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
37394         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
37395         uint64_t ret_ref = 0;
37396         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37397         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37398         return ret_ref;
37399 }
37400 int64_t  __attribute__((export_name("TS_ChannelTypeFeatures_clone_ptr"))) TS_ChannelTypeFeatures_clone_ptr(uint64_t arg) {
37401         LDKChannelTypeFeatures arg_conv;
37402         arg_conv.inner = untag_ptr(arg);
37403         arg_conv.is_owned = ptr_is_owned(arg);
37404         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37405         arg_conv.is_owned = false;
37406         int64_t ret_conv = ChannelTypeFeatures_clone_ptr(&arg_conv);
37407         return ret_conv;
37408 }
37409
37410 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_clone"))) TS_ChannelTypeFeatures_clone(uint64_t orig) {
37411         LDKChannelTypeFeatures orig_conv;
37412         orig_conv.inner = untag_ptr(orig);
37413         orig_conv.is_owned = ptr_is_owned(orig);
37414         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37415         orig_conv.is_owned = false;
37416         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
37417         uint64_t ret_ref = 0;
37418         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37419         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37420         return ret_ref;
37421 }
37422
37423 void  __attribute__((export_name("TS_InitFeatures_free"))) TS_InitFeatures_free(uint64_t this_obj) {
37424         LDKInitFeatures this_obj_conv;
37425         this_obj_conv.inner = untag_ptr(this_obj);
37426         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37428         InitFeatures_free(this_obj_conv);
37429 }
37430
37431 void  __attribute__((export_name("TS_NodeFeatures_free"))) TS_NodeFeatures_free(uint64_t this_obj) {
37432         LDKNodeFeatures this_obj_conv;
37433         this_obj_conv.inner = untag_ptr(this_obj);
37434         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37436         NodeFeatures_free(this_obj_conv);
37437 }
37438
37439 void  __attribute__((export_name("TS_ChannelFeatures_free"))) TS_ChannelFeatures_free(uint64_t this_obj) {
37440         LDKChannelFeatures this_obj_conv;
37441         this_obj_conv.inner = untag_ptr(this_obj);
37442         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37444         ChannelFeatures_free(this_obj_conv);
37445 }
37446
37447 void  __attribute__((export_name("TS_InvoiceFeatures_free"))) TS_InvoiceFeatures_free(uint64_t this_obj) {
37448         LDKInvoiceFeatures this_obj_conv;
37449         this_obj_conv.inner = untag_ptr(this_obj);
37450         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37452         InvoiceFeatures_free(this_obj_conv);
37453 }
37454
37455 void  __attribute__((export_name("TS_ChannelTypeFeatures_free"))) TS_ChannelTypeFeatures_free(uint64_t this_obj) {
37456         LDKChannelTypeFeatures this_obj_conv;
37457         this_obj_conv.inner = untag_ptr(this_obj);
37458         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37460         ChannelTypeFeatures_free(this_obj_conv);
37461 }
37462
37463 uint64_t  __attribute__((export_name("TS_InitFeatures_known_channel_features"))) TS_InitFeatures_known_channel_features() {
37464         LDKInitFeatures ret_var = InitFeatures_known_channel_features();
37465         uint64_t ret_ref = 0;
37466         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37467         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37468         return ret_ref;
37469 }
37470
37471 uint64_t  __attribute__((export_name("TS_NodeFeatures_known_channel_features"))) TS_NodeFeatures_known_channel_features() {
37472         LDKNodeFeatures ret_var = NodeFeatures_known_channel_features();
37473         uint64_t ret_ref = 0;
37474         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37475         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37476         return ret_ref;
37477 }
37478
37479 uint64_t  __attribute__((export_name("TS_InitFeatures_empty"))) TS_InitFeatures_empty() {
37480         LDKInitFeatures ret_var = InitFeatures_empty();
37481         uint64_t ret_ref = 0;
37482         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37483         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37484         return ret_ref;
37485 }
37486
37487 uint64_t  __attribute__((export_name("TS_InitFeatures_known"))) TS_InitFeatures_known() {
37488         LDKInitFeatures ret_var = InitFeatures_known();
37489         uint64_t ret_ref = 0;
37490         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37491         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37492         return ret_ref;
37493 }
37494
37495 jboolean  __attribute__((export_name("TS_InitFeatures_requires_unknown_bits"))) TS_InitFeatures_requires_unknown_bits(uint64_t this_arg) {
37496         LDKInitFeatures this_arg_conv;
37497         this_arg_conv.inner = untag_ptr(this_arg);
37498         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37500         this_arg_conv.is_owned = false;
37501         jboolean ret_conv = InitFeatures_requires_unknown_bits(&this_arg_conv);
37502         return ret_conv;
37503 }
37504
37505 uint64_t  __attribute__((export_name("TS_NodeFeatures_empty"))) TS_NodeFeatures_empty() {
37506         LDKNodeFeatures ret_var = NodeFeatures_empty();
37507         uint64_t ret_ref = 0;
37508         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37509         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37510         return ret_ref;
37511 }
37512
37513 uint64_t  __attribute__((export_name("TS_NodeFeatures_known"))) TS_NodeFeatures_known() {
37514         LDKNodeFeatures ret_var = NodeFeatures_known();
37515         uint64_t ret_ref = 0;
37516         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37517         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37518         return ret_ref;
37519 }
37520
37521 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_unknown_bits"))) TS_NodeFeatures_requires_unknown_bits(uint64_t this_arg) {
37522         LDKNodeFeatures this_arg_conv;
37523         this_arg_conv.inner = untag_ptr(this_arg);
37524         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37526         this_arg_conv.is_owned = false;
37527         jboolean ret_conv = NodeFeatures_requires_unknown_bits(&this_arg_conv);
37528         return ret_conv;
37529 }
37530
37531 uint64_t  __attribute__((export_name("TS_ChannelFeatures_empty"))) TS_ChannelFeatures_empty() {
37532         LDKChannelFeatures ret_var = ChannelFeatures_empty();
37533         uint64_t ret_ref = 0;
37534         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37535         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37536         return ret_ref;
37537 }
37538
37539 uint64_t  __attribute__((export_name("TS_ChannelFeatures_known"))) TS_ChannelFeatures_known() {
37540         LDKChannelFeatures ret_var = ChannelFeatures_known();
37541         uint64_t ret_ref = 0;
37542         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37543         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37544         return ret_ref;
37545 }
37546
37547 jboolean  __attribute__((export_name("TS_ChannelFeatures_requires_unknown_bits"))) TS_ChannelFeatures_requires_unknown_bits(uint64_t this_arg) {
37548         LDKChannelFeatures this_arg_conv;
37549         this_arg_conv.inner = untag_ptr(this_arg);
37550         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37552         this_arg_conv.is_owned = false;
37553         jboolean ret_conv = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
37554         return ret_conv;
37555 }
37556
37557 uint64_t  __attribute__((export_name("TS_InvoiceFeatures_empty"))) TS_InvoiceFeatures_empty() {
37558         LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
37559         uint64_t ret_ref = 0;
37560         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37561         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37562         return ret_ref;
37563 }
37564
37565 uint64_t  __attribute__((export_name("TS_InvoiceFeatures_known"))) TS_InvoiceFeatures_known() {
37566         LDKInvoiceFeatures ret_var = InvoiceFeatures_known();
37567         uint64_t ret_ref = 0;
37568         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37569         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37570         return ret_ref;
37571 }
37572
37573 jboolean  __attribute__((export_name("TS_InvoiceFeatures_requires_unknown_bits"))) TS_InvoiceFeatures_requires_unknown_bits(uint64_t this_arg) {
37574         LDKInvoiceFeatures this_arg_conv;
37575         this_arg_conv.inner = untag_ptr(this_arg);
37576         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37578         this_arg_conv.is_owned = false;
37579         jboolean ret_conv = InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
37580         return ret_conv;
37581 }
37582
37583 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_empty"))) TS_ChannelTypeFeatures_empty() {
37584         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
37585         uint64_t ret_ref = 0;
37586         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37587         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37588         return ret_ref;
37589 }
37590
37591 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_known"))) TS_ChannelTypeFeatures_known() {
37592         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_known();
37593         uint64_t ret_ref = 0;
37594         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37595         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37596         return ret_ref;
37597 }
37598
37599 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_unknown_bits"))) TS_ChannelTypeFeatures_requires_unknown_bits(uint64_t this_arg) {
37600         LDKChannelTypeFeatures this_arg_conv;
37601         this_arg_conv.inner = untag_ptr(this_arg);
37602         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37604         this_arg_conv.is_owned = false;
37605         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
37606         return ret_conv;
37607 }
37608
37609 int8_tArray  __attribute__((export_name("TS_InitFeatures_write"))) TS_InitFeatures_write(uint64_t obj) {
37610         LDKInitFeatures obj_conv;
37611         obj_conv.inner = untag_ptr(obj);
37612         obj_conv.is_owned = ptr_is_owned(obj);
37613         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37614         obj_conv.is_owned = false;
37615         LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
37616         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37617         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37618         CVec_u8Z_free(ret_var);
37619         return ret_arr;
37620 }
37621
37622 uint64_t  __attribute__((export_name("TS_InitFeatures_read"))) TS_InitFeatures_read(int8_tArray ser) {
37623         LDKu8slice ser_ref;
37624         ser_ref.datalen = ser->arr_len;
37625         ser_ref.data = ser->elems;
37626         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
37627         *ret_conv = InitFeatures_read(ser_ref);
37628         FREE(ser);
37629         return tag_ptr(ret_conv, true);
37630 }
37631
37632 int8_tArray  __attribute__((export_name("TS_ChannelFeatures_write"))) TS_ChannelFeatures_write(uint64_t obj) {
37633         LDKChannelFeatures obj_conv;
37634         obj_conv.inner = untag_ptr(obj);
37635         obj_conv.is_owned = ptr_is_owned(obj);
37636         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37637         obj_conv.is_owned = false;
37638         LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
37639         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37640         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37641         CVec_u8Z_free(ret_var);
37642         return ret_arr;
37643 }
37644
37645 uint64_t  __attribute__((export_name("TS_ChannelFeatures_read"))) TS_ChannelFeatures_read(int8_tArray ser) {
37646         LDKu8slice ser_ref;
37647         ser_ref.datalen = ser->arr_len;
37648         ser_ref.data = ser->elems;
37649         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
37650         *ret_conv = ChannelFeatures_read(ser_ref);
37651         FREE(ser);
37652         return tag_ptr(ret_conv, true);
37653 }
37654
37655 int8_tArray  __attribute__((export_name("TS_NodeFeatures_write"))) TS_NodeFeatures_write(uint64_t obj) {
37656         LDKNodeFeatures obj_conv;
37657         obj_conv.inner = untag_ptr(obj);
37658         obj_conv.is_owned = ptr_is_owned(obj);
37659         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37660         obj_conv.is_owned = false;
37661         LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
37662         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37663         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37664         CVec_u8Z_free(ret_var);
37665         return ret_arr;
37666 }
37667
37668 uint64_t  __attribute__((export_name("TS_NodeFeatures_read"))) TS_NodeFeatures_read(int8_tArray ser) {
37669         LDKu8slice ser_ref;
37670         ser_ref.datalen = ser->arr_len;
37671         ser_ref.data = ser->elems;
37672         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
37673         *ret_conv = NodeFeatures_read(ser_ref);
37674         FREE(ser);
37675         return tag_ptr(ret_conv, true);
37676 }
37677
37678 int8_tArray  __attribute__((export_name("TS_InvoiceFeatures_write"))) TS_InvoiceFeatures_write(uint64_t obj) {
37679         LDKInvoiceFeatures obj_conv;
37680         obj_conv.inner = untag_ptr(obj);
37681         obj_conv.is_owned = ptr_is_owned(obj);
37682         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37683         obj_conv.is_owned = false;
37684         LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
37685         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37686         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37687         CVec_u8Z_free(ret_var);
37688         return ret_arr;
37689 }
37690
37691 uint64_t  __attribute__((export_name("TS_InvoiceFeatures_read"))) TS_InvoiceFeatures_read(int8_tArray ser) {
37692         LDKu8slice ser_ref;
37693         ser_ref.datalen = ser->arr_len;
37694         ser_ref.data = ser->elems;
37695         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
37696         *ret_conv = InvoiceFeatures_read(ser_ref);
37697         FREE(ser);
37698         return tag_ptr(ret_conv, true);
37699 }
37700
37701 int8_tArray  __attribute__((export_name("TS_ChannelTypeFeatures_write"))) TS_ChannelTypeFeatures_write(uint64_t obj) {
37702         LDKChannelTypeFeatures obj_conv;
37703         obj_conv.inner = untag_ptr(obj);
37704         obj_conv.is_owned = ptr_is_owned(obj);
37705         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37706         obj_conv.is_owned = false;
37707         LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
37708         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37709         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37710         CVec_u8Z_free(ret_var);
37711         return ret_arr;
37712 }
37713
37714 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_read"))) TS_ChannelTypeFeatures_read(int8_tArray ser) {
37715         LDKu8slice ser_ref;
37716         ser_ref.datalen = ser->arr_len;
37717         ser_ref.data = ser->elems;
37718         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
37719         *ret_conv = ChannelTypeFeatures_read(ser_ref);
37720         FREE(ser);
37721         return tag_ptr(ret_conv, true);
37722 }
37723
37724 void  __attribute__((export_name("TS_InitFeatures_set_data_loss_protect_optional"))) TS_InitFeatures_set_data_loss_protect_optional(uint64_t this_arg) {
37725         LDKInitFeatures this_arg_conv;
37726         this_arg_conv.inner = untag_ptr(this_arg);
37727         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37729         this_arg_conv.is_owned = false;
37730         InitFeatures_set_data_loss_protect_optional(&this_arg_conv);
37731 }
37732
37733 void  __attribute__((export_name("TS_InitFeatures_set_data_loss_protect_required"))) TS_InitFeatures_set_data_loss_protect_required(uint64_t this_arg) {
37734         LDKInitFeatures this_arg_conv;
37735         this_arg_conv.inner = untag_ptr(this_arg);
37736         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37738         this_arg_conv.is_owned = false;
37739         InitFeatures_set_data_loss_protect_required(&this_arg_conv);
37740 }
37741
37742 jboolean  __attribute__((export_name("TS_InitFeatures_supports_data_loss_protect"))) TS_InitFeatures_supports_data_loss_protect(uint64_t this_arg) {
37743         LDKInitFeatures this_arg_conv;
37744         this_arg_conv.inner = untag_ptr(this_arg);
37745         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37747         this_arg_conv.is_owned = false;
37748         jboolean ret_conv = InitFeatures_supports_data_loss_protect(&this_arg_conv);
37749         return ret_conv;
37750 }
37751
37752 void  __attribute__((export_name("TS_NodeFeatures_set_data_loss_protect_optional"))) TS_NodeFeatures_set_data_loss_protect_optional(uint64_t this_arg) {
37753         LDKNodeFeatures this_arg_conv;
37754         this_arg_conv.inner = untag_ptr(this_arg);
37755         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37756         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37757         this_arg_conv.is_owned = false;
37758         NodeFeatures_set_data_loss_protect_optional(&this_arg_conv);
37759 }
37760
37761 void  __attribute__((export_name("TS_NodeFeatures_set_data_loss_protect_required"))) TS_NodeFeatures_set_data_loss_protect_required(uint64_t this_arg) {
37762         LDKNodeFeatures this_arg_conv;
37763         this_arg_conv.inner = untag_ptr(this_arg);
37764         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37765         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37766         this_arg_conv.is_owned = false;
37767         NodeFeatures_set_data_loss_protect_required(&this_arg_conv);
37768 }
37769
37770 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_data_loss_protect"))) TS_NodeFeatures_supports_data_loss_protect(uint64_t this_arg) {
37771         LDKNodeFeatures this_arg_conv;
37772         this_arg_conv.inner = untag_ptr(this_arg);
37773         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37775         this_arg_conv.is_owned = false;
37776         jboolean ret_conv = NodeFeatures_supports_data_loss_protect(&this_arg_conv);
37777         return ret_conv;
37778 }
37779
37780 jboolean  __attribute__((export_name("TS_InitFeatures_requires_data_loss_protect"))) TS_InitFeatures_requires_data_loss_protect(uint64_t this_arg) {
37781         LDKInitFeatures this_arg_conv;
37782         this_arg_conv.inner = untag_ptr(this_arg);
37783         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37784         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37785         this_arg_conv.is_owned = false;
37786         jboolean ret_conv = InitFeatures_requires_data_loss_protect(&this_arg_conv);
37787         return ret_conv;
37788 }
37789
37790 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_data_loss_protect"))) TS_NodeFeatures_requires_data_loss_protect(uint64_t this_arg) {
37791         LDKNodeFeatures this_arg_conv;
37792         this_arg_conv.inner = untag_ptr(this_arg);
37793         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37794         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37795         this_arg_conv.is_owned = false;
37796         jboolean ret_conv = NodeFeatures_requires_data_loss_protect(&this_arg_conv);
37797         return ret_conv;
37798 }
37799
37800 void  __attribute__((export_name("TS_InitFeatures_set_initial_routing_sync_optional"))) TS_InitFeatures_set_initial_routing_sync_optional(uint64_t this_arg) {
37801         LDKInitFeatures this_arg_conv;
37802         this_arg_conv.inner = untag_ptr(this_arg);
37803         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37804         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37805         this_arg_conv.is_owned = false;
37806         InitFeatures_set_initial_routing_sync_optional(&this_arg_conv);
37807 }
37808
37809 void  __attribute__((export_name("TS_InitFeatures_set_initial_routing_sync_required"))) TS_InitFeatures_set_initial_routing_sync_required(uint64_t this_arg) {
37810         LDKInitFeatures this_arg_conv;
37811         this_arg_conv.inner = untag_ptr(this_arg);
37812         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37813         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37814         this_arg_conv.is_owned = false;
37815         InitFeatures_set_initial_routing_sync_required(&this_arg_conv);
37816 }
37817
37818 jboolean  __attribute__((export_name("TS_InitFeatures_initial_routing_sync"))) TS_InitFeatures_initial_routing_sync(uint64_t this_arg) {
37819         LDKInitFeatures this_arg_conv;
37820         this_arg_conv.inner = untag_ptr(this_arg);
37821         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37823         this_arg_conv.is_owned = false;
37824         jboolean ret_conv = InitFeatures_initial_routing_sync(&this_arg_conv);
37825         return ret_conv;
37826 }
37827
37828 void  __attribute__((export_name("TS_InitFeatures_set_upfront_shutdown_script_optional"))) TS_InitFeatures_set_upfront_shutdown_script_optional(uint64_t this_arg) {
37829         LDKInitFeatures this_arg_conv;
37830         this_arg_conv.inner = untag_ptr(this_arg);
37831         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37832         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37833         this_arg_conv.is_owned = false;
37834         InitFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
37835 }
37836
37837 void  __attribute__((export_name("TS_InitFeatures_set_upfront_shutdown_script_required"))) TS_InitFeatures_set_upfront_shutdown_script_required(uint64_t this_arg) {
37838         LDKInitFeatures this_arg_conv;
37839         this_arg_conv.inner = untag_ptr(this_arg);
37840         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37842         this_arg_conv.is_owned = false;
37843         InitFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
37844 }
37845
37846 jboolean  __attribute__((export_name("TS_InitFeatures_supports_upfront_shutdown_script"))) TS_InitFeatures_supports_upfront_shutdown_script(uint64_t this_arg) {
37847         LDKInitFeatures this_arg_conv;
37848         this_arg_conv.inner = untag_ptr(this_arg);
37849         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37851         this_arg_conv.is_owned = false;
37852         jboolean ret_conv = InitFeatures_supports_upfront_shutdown_script(&this_arg_conv);
37853         return ret_conv;
37854 }
37855
37856 void  __attribute__((export_name("TS_NodeFeatures_set_upfront_shutdown_script_optional"))) TS_NodeFeatures_set_upfront_shutdown_script_optional(uint64_t this_arg) {
37857         LDKNodeFeatures this_arg_conv;
37858         this_arg_conv.inner = untag_ptr(this_arg);
37859         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37861         this_arg_conv.is_owned = false;
37862         NodeFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
37863 }
37864
37865 void  __attribute__((export_name("TS_NodeFeatures_set_upfront_shutdown_script_required"))) TS_NodeFeatures_set_upfront_shutdown_script_required(uint64_t this_arg) {
37866         LDKNodeFeatures this_arg_conv;
37867         this_arg_conv.inner = untag_ptr(this_arg);
37868         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37870         this_arg_conv.is_owned = false;
37871         NodeFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
37872 }
37873
37874 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_upfront_shutdown_script"))) TS_NodeFeatures_supports_upfront_shutdown_script(uint64_t this_arg) {
37875         LDKNodeFeatures this_arg_conv;
37876         this_arg_conv.inner = untag_ptr(this_arg);
37877         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37879         this_arg_conv.is_owned = false;
37880         jboolean ret_conv = NodeFeatures_supports_upfront_shutdown_script(&this_arg_conv);
37881         return ret_conv;
37882 }
37883
37884 jboolean  __attribute__((export_name("TS_InitFeatures_requires_upfront_shutdown_script"))) TS_InitFeatures_requires_upfront_shutdown_script(uint64_t this_arg) {
37885         LDKInitFeatures this_arg_conv;
37886         this_arg_conv.inner = untag_ptr(this_arg);
37887         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37889         this_arg_conv.is_owned = false;
37890         jboolean ret_conv = InitFeatures_requires_upfront_shutdown_script(&this_arg_conv);
37891         return ret_conv;
37892 }
37893
37894 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_upfront_shutdown_script"))) TS_NodeFeatures_requires_upfront_shutdown_script(uint64_t this_arg) {
37895         LDKNodeFeatures this_arg_conv;
37896         this_arg_conv.inner = untag_ptr(this_arg);
37897         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37898         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37899         this_arg_conv.is_owned = false;
37900         jboolean ret_conv = NodeFeatures_requires_upfront_shutdown_script(&this_arg_conv);
37901         return ret_conv;
37902 }
37903
37904 void  __attribute__((export_name("TS_InitFeatures_set_gossip_queries_optional"))) TS_InitFeatures_set_gossip_queries_optional(uint64_t this_arg) {
37905         LDKInitFeatures this_arg_conv;
37906         this_arg_conv.inner = untag_ptr(this_arg);
37907         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37909         this_arg_conv.is_owned = false;
37910         InitFeatures_set_gossip_queries_optional(&this_arg_conv);
37911 }
37912
37913 void  __attribute__((export_name("TS_InitFeatures_set_gossip_queries_required"))) TS_InitFeatures_set_gossip_queries_required(uint64_t this_arg) {
37914         LDKInitFeatures this_arg_conv;
37915         this_arg_conv.inner = untag_ptr(this_arg);
37916         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37918         this_arg_conv.is_owned = false;
37919         InitFeatures_set_gossip_queries_required(&this_arg_conv);
37920 }
37921
37922 jboolean  __attribute__((export_name("TS_InitFeatures_supports_gossip_queries"))) TS_InitFeatures_supports_gossip_queries(uint64_t this_arg) {
37923         LDKInitFeatures this_arg_conv;
37924         this_arg_conv.inner = untag_ptr(this_arg);
37925         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37927         this_arg_conv.is_owned = false;
37928         jboolean ret_conv = InitFeatures_supports_gossip_queries(&this_arg_conv);
37929         return ret_conv;
37930 }
37931
37932 void  __attribute__((export_name("TS_NodeFeatures_set_gossip_queries_optional"))) TS_NodeFeatures_set_gossip_queries_optional(uint64_t this_arg) {
37933         LDKNodeFeatures this_arg_conv;
37934         this_arg_conv.inner = untag_ptr(this_arg);
37935         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37936         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37937         this_arg_conv.is_owned = false;
37938         NodeFeatures_set_gossip_queries_optional(&this_arg_conv);
37939 }
37940
37941 void  __attribute__((export_name("TS_NodeFeatures_set_gossip_queries_required"))) TS_NodeFeatures_set_gossip_queries_required(uint64_t this_arg) {
37942         LDKNodeFeatures this_arg_conv;
37943         this_arg_conv.inner = untag_ptr(this_arg);
37944         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37946         this_arg_conv.is_owned = false;
37947         NodeFeatures_set_gossip_queries_required(&this_arg_conv);
37948 }
37949
37950 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_gossip_queries"))) TS_NodeFeatures_supports_gossip_queries(uint64_t this_arg) {
37951         LDKNodeFeatures this_arg_conv;
37952         this_arg_conv.inner = untag_ptr(this_arg);
37953         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37955         this_arg_conv.is_owned = false;
37956         jboolean ret_conv = NodeFeatures_supports_gossip_queries(&this_arg_conv);
37957         return ret_conv;
37958 }
37959
37960 jboolean  __attribute__((export_name("TS_InitFeatures_requires_gossip_queries"))) TS_InitFeatures_requires_gossip_queries(uint64_t this_arg) {
37961         LDKInitFeatures this_arg_conv;
37962         this_arg_conv.inner = untag_ptr(this_arg);
37963         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37965         this_arg_conv.is_owned = false;
37966         jboolean ret_conv = InitFeatures_requires_gossip_queries(&this_arg_conv);
37967         return ret_conv;
37968 }
37969
37970 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_gossip_queries"))) TS_NodeFeatures_requires_gossip_queries(uint64_t this_arg) {
37971         LDKNodeFeatures this_arg_conv;
37972         this_arg_conv.inner = untag_ptr(this_arg);
37973         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37975         this_arg_conv.is_owned = false;
37976         jboolean ret_conv = NodeFeatures_requires_gossip_queries(&this_arg_conv);
37977         return ret_conv;
37978 }
37979
37980 void  __attribute__((export_name("TS_InitFeatures_set_variable_length_onion_optional"))) TS_InitFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
37981         LDKInitFeatures this_arg_conv;
37982         this_arg_conv.inner = untag_ptr(this_arg);
37983         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37985         this_arg_conv.is_owned = false;
37986         InitFeatures_set_variable_length_onion_optional(&this_arg_conv);
37987 }
37988
37989 void  __attribute__((export_name("TS_InitFeatures_set_variable_length_onion_required"))) TS_InitFeatures_set_variable_length_onion_required(uint64_t this_arg) {
37990         LDKInitFeatures this_arg_conv;
37991         this_arg_conv.inner = untag_ptr(this_arg);
37992         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37994         this_arg_conv.is_owned = false;
37995         InitFeatures_set_variable_length_onion_required(&this_arg_conv);
37996 }
37997
37998 jboolean  __attribute__((export_name("TS_InitFeatures_supports_variable_length_onion"))) TS_InitFeatures_supports_variable_length_onion(uint64_t this_arg) {
37999         LDKInitFeatures this_arg_conv;
38000         this_arg_conv.inner = untag_ptr(this_arg);
38001         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38003         this_arg_conv.is_owned = false;
38004         jboolean ret_conv = InitFeatures_supports_variable_length_onion(&this_arg_conv);
38005         return ret_conv;
38006 }
38007
38008 void  __attribute__((export_name("TS_NodeFeatures_set_variable_length_onion_optional"))) TS_NodeFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
38009         LDKNodeFeatures this_arg_conv;
38010         this_arg_conv.inner = untag_ptr(this_arg);
38011         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38013         this_arg_conv.is_owned = false;
38014         NodeFeatures_set_variable_length_onion_optional(&this_arg_conv);
38015 }
38016
38017 void  __attribute__((export_name("TS_NodeFeatures_set_variable_length_onion_required"))) TS_NodeFeatures_set_variable_length_onion_required(uint64_t this_arg) {
38018         LDKNodeFeatures this_arg_conv;
38019         this_arg_conv.inner = untag_ptr(this_arg);
38020         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38022         this_arg_conv.is_owned = false;
38023         NodeFeatures_set_variable_length_onion_required(&this_arg_conv);
38024 }
38025
38026 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_variable_length_onion"))) TS_NodeFeatures_supports_variable_length_onion(uint64_t this_arg) {
38027         LDKNodeFeatures this_arg_conv;
38028         this_arg_conv.inner = untag_ptr(this_arg);
38029         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38031         this_arg_conv.is_owned = false;
38032         jboolean ret_conv = NodeFeatures_supports_variable_length_onion(&this_arg_conv);
38033         return ret_conv;
38034 }
38035
38036 void  __attribute__((export_name("TS_InvoiceFeatures_set_variable_length_onion_optional"))) TS_InvoiceFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
38037         LDKInvoiceFeatures this_arg_conv;
38038         this_arg_conv.inner = untag_ptr(this_arg);
38039         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38040         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38041         this_arg_conv.is_owned = false;
38042         InvoiceFeatures_set_variable_length_onion_optional(&this_arg_conv);
38043 }
38044
38045 void  __attribute__((export_name("TS_InvoiceFeatures_set_variable_length_onion_required"))) TS_InvoiceFeatures_set_variable_length_onion_required(uint64_t this_arg) {
38046         LDKInvoiceFeatures this_arg_conv;
38047         this_arg_conv.inner = untag_ptr(this_arg);
38048         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38049         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38050         this_arg_conv.is_owned = false;
38051         InvoiceFeatures_set_variable_length_onion_required(&this_arg_conv);
38052 }
38053
38054 jboolean  __attribute__((export_name("TS_InvoiceFeatures_supports_variable_length_onion"))) TS_InvoiceFeatures_supports_variable_length_onion(uint64_t this_arg) {
38055         LDKInvoiceFeatures this_arg_conv;
38056         this_arg_conv.inner = untag_ptr(this_arg);
38057         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38059         this_arg_conv.is_owned = false;
38060         jboolean ret_conv = InvoiceFeatures_supports_variable_length_onion(&this_arg_conv);
38061         return ret_conv;
38062 }
38063
38064 jboolean  __attribute__((export_name("TS_InitFeatures_requires_variable_length_onion"))) TS_InitFeatures_requires_variable_length_onion(uint64_t this_arg) {
38065         LDKInitFeatures this_arg_conv;
38066         this_arg_conv.inner = untag_ptr(this_arg);
38067         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38069         this_arg_conv.is_owned = false;
38070         jboolean ret_conv = InitFeatures_requires_variable_length_onion(&this_arg_conv);
38071         return ret_conv;
38072 }
38073
38074 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_variable_length_onion"))) TS_NodeFeatures_requires_variable_length_onion(uint64_t this_arg) {
38075         LDKNodeFeatures this_arg_conv;
38076         this_arg_conv.inner = untag_ptr(this_arg);
38077         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38079         this_arg_conv.is_owned = false;
38080         jboolean ret_conv = NodeFeatures_requires_variable_length_onion(&this_arg_conv);
38081         return ret_conv;
38082 }
38083
38084 jboolean  __attribute__((export_name("TS_InvoiceFeatures_requires_variable_length_onion"))) TS_InvoiceFeatures_requires_variable_length_onion(uint64_t this_arg) {
38085         LDKInvoiceFeatures this_arg_conv;
38086         this_arg_conv.inner = untag_ptr(this_arg);
38087         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38089         this_arg_conv.is_owned = false;
38090         jboolean ret_conv = InvoiceFeatures_requires_variable_length_onion(&this_arg_conv);
38091         return ret_conv;
38092 }
38093
38094 void  __attribute__((export_name("TS_InitFeatures_set_static_remote_key_optional"))) TS_InitFeatures_set_static_remote_key_optional(uint64_t this_arg) {
38095         LDKInitFeatures this_arg_conv;
38096         this_arg_conv.inner = untag_ptr(this_arg);
38097         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38099         this_arg_conv.is_owned = false;
38100         InitFeatures_set_static_remote_key_optional(&this_arg_conv);
38101 }
38102
38103 void  __attribute__((export_name("TS_InitFeatures_set_static_remote_key_required"))) TS_InitFeatures_set_static_remote_key_required(uint64_t this_arg) {
38104         LDKInitFeatures this_arg_conv;
38105         this_arg_conv.inner = untag_ptr(this_arg);
38106         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38108         this_arg_conv.is_owned = false;
38109         InitFeatures_set_static_remote_key_required(&this_arg_conv);
38110 }
38111
38112 jboolean  __attribute__((export_name("TS_InitFeatures_supports_static_remote_key"))) TS_InitFeatures_supports_static_remote_key(uint64_t this_arg) {
38113         LDKInitFeatures this_arg_conv;
38114         this_arg_conv.inner = untag_ptr(this_arg);
38115         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38117         this_arg_conv.is_owned = false;
38118         jboolean ret_conv = InitFeatures_supports_static_remote_key(&this_arg_conv);
38119         return ret_conv;
38120 }
38121
38122 void  __attribute__((export_name("TS_NodeFeatures_set_static_remote_key_optional"))) TS_NodeFeatures_set_static_remote_key_optional(uint64_t this_arg) {
38123         LDKNodeFeatures this_arg_conv;
38124         this_arg_conv.inner = untag_ptr(this_arg);
38125         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38127         this_arg_conv.is_owned = false;
38128         NodeFeatures_set_static_remote_key_optional(&this_arg_conv);
38129 }
38130
38131 void  __attribute__((export_name("TS_NodeFeatures_set_static_remote_key_required"))) TS_NodeFeatures_set_static_remote_key_required(uint64_t this_arg) {
38132         LDKNodeFeatures this_arg_conv;
38133         this_arg_conv.inner = untag_ptr(this_arg);
38134         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38135         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38136         this_arg_conv.is_owned = false;
38137         NodeFeatures_set_static_remote_key_required(&this_arg_conv);
38138 }
38139
38140 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_static_remote_key"))) TS_NodeFeatures_supports_static_remote_key(uint64_t this_arg) {
38141         LDKNodeFeatures this_arg_conv;
38142         this_arg_conv.inner = untag_ptr(this_arg);
38143         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38145         this_arg_conv.is_owned = false;
38146         jboolean ret_conv = NodeFeatures_supports_static_remote_key(&this_arg_conv);
38147         return ret_conv;
38148 }
38149
38150 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_static_remote_key_optional"))) TS_ChannelTypeFeatures_set_static_remote_key_optional(uint64_t this_arg) {
38151         LDKChannelTypeFeatures this_arg_conv;
38152         this_arg_conv.inner = untag_ptr(this_arg);
38153         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38155         this_arg_conv.is_owned = false;
38156         ChannelTypeFeatures_set_static_remote_key_optional(&this_arg_conv);
38157 }
38158
38159 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_static_remote_key_required"))) TS_ChannelTypeFeatures_set_static_remote_key_required(uint64_t this_arg) {
38160         LDKChannelTypeFeatures this_arg_conv;
38161         this_arg_conv.inner = untag_ptr(this_arg);
38162         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38164         this_arg_conv.is_owned = false;
38165         ChannelTypeFeatures_set_static_remote_key_required(&this_arg_conv);
38166 }
38167
38168 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_static_remote_key"))) TS_ChannelTypeFeatures_supports_static_remote_key(uint64_t this_arg) {
38169         LDKChannelTypeFeatures this_arg_conv;
38170         this_arg_conv.inner = untag_ptr(this_arg);
38171         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38173         this_arg_conv.is_owned = false;
38174         jboolean ret_conv = ChannelTypeFeatures_supports_static_remote_key(&this_arg_conv);
38175         return ret_conv;
38176 }
38177
38178 jboolean  __attribute__((export_name("TS_InitFeatures_requires_static_remote_key"))) TS_InitFeatures_requires_static_remote_key(uint64_t this_arg) {
38179         LDKInitFeatures this_arg_conv;
38180         this_arg_conv.inner = untag_ptr(this_arg);
38181         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38183         this_arg_conv.is_owned = false;
38184         jboolean ret_conv = InitFeatures_requires_static_remote_key(&this_arg_conv);
38185         return ret_conv;
38186 }
38187
38188 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_static_remote_key"))) TS_NodeFeatures_requires_static_remote_key(uint64_t this_arg) {
38189         LDKNodeFeatures this_arg_conv;
38190         this_arg_conv.inner = untag_ptr(this_arg);
38191         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38193         this_arg_conv.is_owned = false;
38194         jboolean ret_conv = NodeFeatures_requires_static_remote_key(&this_arg_conv);
38195         return ret_conv;
38196 }
38197
38198 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_static_remote_key"))) TS_ChannelTypeFeatures_requires_static_remote_key(uint64_t this_arg) {
38199         LDKChannelTypeFeatures this_arg_conv;
38200         this_arg_conv.inner = untag_ptr(this_arg);
38201         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38203         this_arg_conv.is_owned = false;
38204         jboolean ret_conv = ChannelTypeFeatures_requires_static_remote_key(&this_arg_conv);
38205         return ret_conv;
38206 }
38207
38208 void  __attribute__((export_name("TS_InitFeatures_set_payment_secret_optional"))) TS_InitFeatures_set_payment_secret_optional(uint64_t this_arg) {
38209         LDKInitFeatures this_arg_conv;
38210         this_arg_conv.inner = untag_ptr(this_arg);
38211         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38213         this_arg_conv.is_owned = false;
38214         InitFeatures_set_payment_secret_optional(&this_arg_conv);
38215 }
38216
38217 void  __attribute__((export_name("TS_InitFeatures_set_payment_secret_required"))) TS_InitFeatures_set_payment_secret_required(uint64_t this_arg) {
38218         LDKInitFeatures this_arg_conv;
38219         this_arg_conv.inner = untag_ptr(this_arg);
38220         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38222         this_arg_conv.is_owned = false;
38223         InitFeatures_set_payment_secret_required(&this_arg_conv);
38224 }
38225
38226 jboolean  __attribute__((export_name("TS_InitFeatures_supports_payment_secret"))) TS_InitFeatures_supports_payment_secret(uint64_t this_arg) {
38227         LDKInitFeatures this_arg_conv;
38228         this_arg_conv.inner = untag_ptr(this_arg);
38229         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38231         this_arg_conv.is_owned = false;
38232         jboolean ret_conv = InitFeatures_supports_payment_secret(&this_arg_conv);
38233         return ret_conv;
38234 }
38235
38236 void  __attribute__((export_name("TS_NodeFeatures_set_payment_secret_optional"))) TS_NodeFeatures_set_payment_secret_optional(uint64_t this_arg) {
38237         LDKNodeFeatures this_arg_conv;
38238         this_arg_conv.inner = untag_ptr(this_arg);
38239         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38241         this_arg_conv.is_owned = false;
38242         NodeFeatures_set_payment_secret_optional(&this_arg_conv);
38243 }
38244
38245 void  __attribute__((export_name("TS_NodeFeatures_set_payment_secret_required"))) TS_NodeFeatures_set_payment_secret_required(uint64_t this_arg) {
38246         LDKNodeFeatures this_arg_conv;
38247         this_arg_conv.inner = untag_ptr(this_arg);
38248         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38250         this_arg_conv.is_owned = false;
38251         NodeFeatures_set_payment_secret_required(&this_arg_conv);
38252 }
38253
38254 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_payment_secret"))) TS_NodeFeatures_supports_payment_secret(uint64_t this_arg) {
38255         LDKNodeFeatures this_arg_conv;
38256         this_arg_conv.inner = untag_ptr(this_arg);
38257         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38259         this_arg_conv.is_owned = false;
38260         jboolean ret_conv = NodeFeatures_supports_payment_secret(&this_arg_conv);
38261         return ret_conv;
38262 }
38263
38264 void  __attribute__((export_name("TS_InvoiceFeatures_set_payment_secret_optional"))) TS_InvoiceFeatures_set_payment_secret_optional(uint64_t this_arg) {
38265         LDKInvoiceFeatures this_arg_conv;
38266         this_arg_conv.inner = untag_ptr(this_arg);
38267         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38269         this_arg_conv.is_owned = false;
38270         InvoiceFeatures_set_payment_secret_optional(&this_arg_conv);
38271 }
38272
38273 void  __attribute__((export_name("TS_InvoiceFeatures_set_payment_secret_required"))) TS_InvoiceFeatures_set_payment_secret_required(uint64_t this_arg) {
38274         LDKInvoiceFeatures this_arg_conv;
38275         this_arg_conv.inner = untag_ptr(this_arg);
38276         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38278         this_arg_conv.is_owned = false;
38279         InvoiceFeatures_set_payment_secret_required(&this_arg_conv);
38280 }
38281
38282 jboolean  __attribute__((export_name("TS_InvoiceFeatures_supports_payment_secret"))) TS_InvoiceFeatures_supports_payment_secret(uint64_t this_arg) {
38283         LDKInvoiceFeatures this_arg_conv;
38284         this_arg_conv.inner = untag_ptr(this_arg);
38285         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38287         this_arg_conv.is_owned = false;
38288         jboolean ret_conv = InvoiceFeatures_supports_payment_secret(&this_arg_conv);
38289         return ret_conv;
38290 }
38291
38292 jboolean  __attribute__((export_name("TS_InitFeatures_requires_payment_secret"))) TS_InitFeatures_requires_payment_secret(uint64_t this_arg) {
38293         LDKInitFeatures this_arg_conv;
38294         this_arg_conv.inner = untag_ptr(this_arg);
38295         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38297         this_arg_conv.is_owned = false;
38298         jboolean ret_conv = InitFeatures_requires_payment_secret(&this_arg_conv);
38299         return ret_conv;
38300 }
38301
38302 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_payment_secret"))) TS_NodeFeatures_requires_payment_secret(uint64_t this_arg) {
38303         LDKNodeFeatures this_arg_conv;
38304         this_arg_conv.inner = untag_ptr(this_arg);
38305         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38307         this_arg_conv.is_owned = false;
38308         jboolean ret_conv = NodeFeatures_requires_payment_secret(&this_arg_conv);
38309         return ret_conv;
38310 }
38311
38312 jboolean  __attribute__((export_name("TS_InvoiceFeatures_requires_payment_secret"))) TS_InvoiceFeatures_requires_payment_secret(uint64_t this_arg) {
38313         LDKInvoiceFeatures this_arg_conv;
38314         this_arg_conv.inner = untag_ptr(this_arg);
38315         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38317         this_arg_conv.is_owned = false;
38318         jboolean ret_conv = InvoiceFeatures_requires_payment_secret(&this_arg_conv);
38319         return ret_conv;
38320 }
38321
38322 void  __attribute__((export_name("TS_InitFeatures_set_basic_mpp_optional"))) TS_InitFeatures_set_basic_mpp_optional(uint64_t this_arg) {
38323         LDKInitFeatures this_arg_conv;
38324         this_arg_conv.inner = untag_ptr(this_arg);
38325         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38327         this_arg_conv.is_owned = false;
38328         InitFeatures_set_basic_mpp_optional(&this_arg_conv);
38329 }
38330
38331 void  __attribute__((export_name("TS_InitFeatures_set_basic_mpp_required"))) TS_InitFeatures_set_basic_mpp_required(uint64_t this_arg) {
38332         LDKInitFeatures this_arg_conv;
38333         this_arg_conv.inner = untag_ptr(this_arg);
38334         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38336         this_arg_conv.is_owned = false;
38337         InitFeatures_set_basic_mpp_required(&this_arg_conv);
38338 }
38339
38340 jboolean  __attribute__((export_name("TS_InitFeatures_supports_basic_mpp"))) TS_InitFeatures_supports_basic_mpp(uint64_t this_arg) {
38341         LDKInitFeatures this_arg_conv;
38342         this_arg_conv.inner = untag_ptr(this_arg);
38343         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38345         this_arg_conv.is_owned = false;
38346         jboolean ret_conv = InitFeatures_supports_basic_mpp(&this_arg_conv);
38347         return ret_conv;
38348 }
38349
38350 void  __attribute__((export_name("TS_NodeFeatures_set_basic_mpp_optional"))) TS_NodeFeatures_set_basic_mpp_optional(uint64_t this_arg) {
38351         LDKNodeFeatures this_arg_conv;
38352         this_arg_conv.inner = untag_ptr(this_arg);
38353         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38354         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38355         this_arg_conv.is_owned = false;
38356         NodeFeatures_set_basic_mpp_optional(&this_arg_conv);
38357 }
38358
38359 void  __attribute__((export_name("TS_NodeFeatures_set_basic_mpp_required"))) TS_NodeFeatures_set_basic_mpp_required(uint64_t this_arg) {
38360         LDKNodeFeatures this_arg_conv;
38361         this_arg_conv.inner = untag_ptr(this_arg);
38362         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38363         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38364         this_arg_conv.is_owned = false;
38365         NodeFeatures_set_basic_mpp_required(&this_arg_conv);
38366 }
38367
38368 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_basic_mpp"))) TS_NodeFeatures_supports_basic_mpp(uint64_t this_arg) {
38369         LDKNodeFeatures this_arg_conv;
38370         this_arg_conv.inner = untag_ptr(this_arg);
38371         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38373         this_arg_conv.is_owned = false;
38374         jboolean ret_conv = NodeFeatures_supports_basic_mpp(&this_arg_conv);
38375         return ret_conv;
38376 }
38377
38378 void  __attribute__((export_name("TS_InvoiceFeatures_set_basic_mpp_optional"))) TS_InvoiceFeatures_set_basic_mpp_optional(uint64_t this_arg) {
38379         LDKInvoiceFeatures this_arg_conv;
38380         this_arg_conv.inner = untag_ptr(this_arg);
38381         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38383         this_arg_conv.is_owned = false;
38384         InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
38385 }
38386
38387 void  __attribute__((export_name("TS_InvoiceFeatures_set_basic_mpp_required"))) TS_InvoiceFeatures_set_basic_mpp_required(uint64_t this_arg) {
38388         LDKInvoiceFeatures this_arg_conv;
38389         this_arg_conv.inner = untag_ptr(this_arg);
38390         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38392         this_arg_conv.is_owned = false;
38393         InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
38394 }
38395
38396 jboolean  __attribute__((export_name("TS_InvoiceFeatures_supports_basic_mpp"))) TS_InvoiceFeatures_supports_basic_mpp(uint64_t this_arg) {
38397         LDKInvoiceFeatures this_arg_conv;
38398         this_arg_conv.inner = untag_ptr(this_arg);
38399         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38401         this_arg_conv.is_owned = false;
38402         jboolean ret_conv = InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
38403         return ret_conv;
38404 }
38405
38406 jboolean  __attribute__((export_name("TS_InitFeatures_requires_basic_mpp"))) TS_InitFeatures_requires_basic_mpp(uint64_t this_arg) {
38407         LDKInitFeatures this_arg_conv;
38408         this_arg_conv.inner = untag_ptr(this_arg);
38409         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38411         this_arg_conv.is_owned = false;
38412         jboolean ret_conv = InitFeatures_requires_basic_mpp(&this_arg_conv);
38413         return ret_conv;
38414 }
38415
38416 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_basic_mpp"))) TS_NodeFeatures_requires_basic_mpp(uint64_t this_arg) {
38417         LDKNodeFeatures this_arg_conv;
38418         this_arg_conv.inner = untag_ptr(this_arg);
38419         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38421         this_arg_conv.is_owned = false;
38422         jboolean ret_conv = NodeFeatures_requires_basic_mpp(&this_arg_conv);
38423         return ret_conv;
38424 }
38425
38426 jboolean  __attribute__((export_name("TS_InvoiceFeatures_requires_basic_mpp"))) TS_InvoiceFeatures_requires_basic_mpp(uint64_t this_arg) {
38427         LDKInvoiceFeatures this_arg_conv;
38428         this_arg_conv.inner = untag_ptr(this_arg);
38429         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38431         this_arg_conv.is_owned = false;
38432         jboolean ret_conv = InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
38433         return ret_conv;
38434 }
38435
38436 void  __attribute__((export_name("TS_InitFeatures_set_wumbo_optional"))) TS_InitFeatures_set_wumbo_optional(uint64_t this_arg) {
38437         LDKInitFeatures this_arg_conv;
38438         this_arg_conv.inner = untag_ptr(this_arg);
38439         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38441         this_arg_conv.is_owned = false;
38442         InitFeatures_set_wumbo_optional(&this_arg_conv);
38443 }
38444
38445 void  __attribute__((export_name("TS_InitFeatures_set_wumbo_required"))) TS_InitFeatures_set_wumbo_required(uint64_t this_arg) {
38446         LDKInitFeatures this_arg_conv;
38447         this_arg_conv.inner = untag_ptr(this_arg);
38448         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38450         this_arg_conv.is_owned = false;
38451         InitFeatures_set_wumbo_required(&this_arg_conv);
38452 }
38453
38454 jboolean  __attribute__((export_name("TS_InitFeatures_supports_wumbo"))) TS_InitFeatures_supports_wumbo(uint64_t this_arg) {
38455         LDKInitFeatures this_arg_conv;
38456         this_arg_conv.inner = untag_ptr(this_arg);
38457         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38459         this_arg_conv.is_owned = false;
38460         jboolean ret_conv = InitFeatures_supports_wumbo(&this_arg_conv);
38461         return ret_conv;
38462 }
38463
38464 void  __attribute__((export_name("TS_NodeFeatures_set_wumbo_optional"))) TS_NodeFeatures_set_wumbo_optional(uint64_t this_arg) {
38465         LDKNodeFeatures this_arg_conv;
38466         this_arg_conv.inner = untag_ptr(this_arg);
38467         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38469         this_arg_conv.is_owned = false;
38470         NodeFeatures_set_wumbo_optional(&this_arg_conv);
38471 }
38472
38473 void  __attribute__((export_name("TS_NodeFeatures_set_wumbo_required"))) TS_NodeFeatures_set_wumbo_required(uint64_t this_arg) {
38474         LDKNodeFeatures this_arg_conv;
38475         this_arg_conv.inner = untag_ptr(this_arg);
38476         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38478         this_arg_conv.is_owned = false;
38479         NodeFeatures_set_wumbo_required(&this_arg_conv);
38480 }
38481
38482 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_wumbo"))) TS_NodeFeatures_supports_wumbo(uint64_t this_arg) {
38483         LDKNodeFeatures this_arg_conv;
38484         this_arg_conv.inner = untag_ptr(this_arg);
38485         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38487         this_arg_conv.is_owned = false;
38488         jboolean ret_conv = NodeFeatures_supports_wumbo(&this_arg_conv);
38489         return ret_conv;
38490 }
38491
38492 jboolean  __attribute__((export_name("TS_InitFeatures_requires_wumbo"))) TS_InitFeatures_requires_wumbo(uint64_t this_arg) {
38493         LDKInitFeatures this_arg_conv;
38494         this_arg_conv.inner = untag_ptr(this_arg);
38495         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38497         this_arg_conv.is_owned = false;
38498         jboolean ret_conv = InitFeatures_requires_wumbo(&this_arg_conv);
38499         return ret_conv;
38500 }
38501
38502 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_wumbo"))) TS_NodeFeatures_requires_wumbo(uint64_t this_arg) {
38503         LDKNodeFeatures this_arg_conv;
38504         this_arg_conv.inner = untag_ptr(this_arg);
38505         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38506         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38507         this_arg_conv.is_owned = false;
38508         jboolean ret_conv = NodeFeatures_requires_wumbo(&this_arg_conv);
38509         return ret_conv;
38510 }
38511
38512 void  __attribute__((export_name("TS_InitFeatures_set_shutdown_any_segwit_optional"))) TS_InitFeatures_set_shutdown_any_segwit_optional(uint64_t this_arg) {
38513         LDKInitFeatures this_arg_conv;
38514         this_arg_conv.inner = untag_ptr(this_arg);
38515         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38517         this_arg_conv.is_owned = false;
38518         InitFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
38519 }
38520
38521 void  __attribute__((export_name("TS_InitFeatures_set_shutdown_any_segwit_required"))) TS_InitFeatures_set_shutdown_any_segwit_required(uint64_t this_arg) {
38522         LDKInitFeatures this_arg_conv;
38523         this_arg_conv.inner = untag_ptr(this_arg);
38524         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38526         this_arg_conv.is_owned = false;
38527         InitFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
38528 }
38529
38530 jboolean  __attribute__((export_name("TS_InitFeatures_supports_shutdown_anysegwit"))) TS_InitFeatures_supports_shutdown_anysegwit(uint64_t this_arg) {
38531         LDKInitFeatures this_arg_conv;
38532         this_arg_conv.inner = untag_ptr(this_arg);
38533         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38535         this_arg_conv.is_owned = false;
38536         jboolean ret_conv = InitFeatures_supports_shutdown_anysegwit(&this_arg_conv);
38537         return ret_conv;
38538 }
38539
38540 void  __attribute__((export_name("TS_NodeFeatures_set_shutdown_any_segwit_optional"))) TS_NodeFeatures_set_shutdown_any_segwit_optional(uint64_t this_arg) {
38541         LDKNodeFeatures this_arg_conv;
38542         this_arg_conv.inner = untag_ptr(this_arg);
38543         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38545         this_arg_conv.is_owned = false;
38546         NodeFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
38547 }
38548
38549 void  __attribute__((export_name("TS_NodeFeatures_set_shutdown_any_segwit_required"))) TS_NodeFeatures_set_shutdown_any_segwit_required(uint64_t this_arg) {
38550         LDKNodeFeatures this_arg_conv;
38551         this_arg_conv.inner = untag_ptr(this_arg);
38552         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38554         this_arg_conv.is_owned = false;
38555         NodeFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
38556 }
38557
38558 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_shutdown_anysegwit"))) TS_NodeFeatures_supports_shutdown_anysegwit(uint64_t this_arg) {
38559         LDKNodeFeatures this_arg_conv;
38560         this_arg_conv.inner = untag_ptr(this_arg);
38561         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38563         this_arg_conv.is_owned = false;
38564         jboolean ret_conv = NodeFeatures_supports_shutdown_anysegwit(&this_arg_conv);
38565         return ret_conv;
38566 }
38567
38568 jboolean  __attribute__((export_name("TS_InitFeatures_requires_shutdown_anysegwit"))) TS_InitFeatures_requires_shutdown_anysegwit(uint64_t this_arg) {
38569         LDKInitFeatures this_arg_conv;
38570         this_arg_conv.inner = untag_ptr(this_arg);
38571         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38573         this_arg_conv.is_owned = false;
38574         jboolean ret_conv = InitFeatures_requires_shutdown_anysegwit(&this_arg_conv);
38575         return ret_conv;
38576 }
38577
38578 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_shutdown_anysegwit"))) TS_NodeFeatures_requires_shutdown_anysegwit(uint64_t this_arg) {
38579         LDKNodeFeatures this_arg_conv;
38580         this_arg_conv.inner = untag_ptr(this_arg);
38581         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38583         this_arg_conv.is_owned = false;
38584         jboolean ret_conv = NodeFeatures_requires_shutdown_anysegwit(&this_arg_conv);
38585         return ret_conv;
38586 }
38587
38588 void  __attribute__((export_name("TS_InitFeatures_set_onion_messages_optional"))) TS_InitFeatures_set_onion_messages_optional(uint64_t this_arg) {
38589         LDKInitFeatures this_arg_conv;
38590         this_arg_conv.inner = untag_ptr(this_arg);
38591         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38593         this_arg_conv.is_owned = false;
38594         InitFeatures_set_onion_messages_optional(&this_arg_conv);
38595 }
38596
38597 void  __attribute__((export_name("TS_InitFeatures_set_onion_messages_required"))) TS_InitFeatures_set_onion_messages_required(uint64_t this_arg) {
38598         LDKInitFeatures this_arg_conv;
38599         this_arg_conv.inner = untag_ptr(this_arg);
38600         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38602         this_arg_conv.is_owned = false;
38603         InitFeatures_set_onion_messages_required(&this_arg_conv);
38604 }
38605
38606 jboolean  __attribute__((export_name("TS_InitFeatures_supports_onion_messages"))) TS_InitFeatures_supports_onion_messages(uint64_t this_arg) {
38607         LDKInitFeatures this_arg_conv;
38608         this_arg_conv.inner = untag_ptr(this_arg);
38609         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38611         this_arg_conv.is_owned = false;
38612         jboolean ret_conv = InitFeatures_supports_onion_messages(&this_arg_conv);
38613         return ret_conv;
38614 }
38615
38616 void  __attribute__((export_name("TS_NodeFeatures_set_onion_messages_optional"))) TS_NodeFeatures_set_onion_messages_optional(uint64_t this_arg) {
38617         LDKNodeFeatures this_arg_conv;
38618         this_arg_conv.inner = untag_ptr(this_arg);
38619         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38621         this_arg_conv.is_owned = false;
38622         NodeFeatures_set_onion_messages_optional(&this_arg_conv);
38623 }
38624
38625 void  __attribute__((export_name("TS_NodeFeatures_set_onion_messages_required"))) TS_NodeFeatures_set_onion_messages_required(uint64_t this_arg) {
38626         LDKNodeFeatures this_arg_conv;
38627         this_arg_conv.inner = untag_ptr(this_arg);
38628         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38630         this_arg_conv.is_owned = false;
38631         NodeFeatures_set_onion_messages_required(&this_arg_conv);
38632 }
38633
38634 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_onion_messages"))) TS_NodeFeatures_supports_onion_messages(uint64_t this_arg) {
38635         LDKNodeFeatures this_arg_conv;
38636         this_arg_conv.inner = untag_ptr(this_arg);
38637         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38639         this_arg_conv.is_owned = false;
38640         jboolean ret_conv = NodeFeatures_supports_onion_messages(&this_arg_conv);
38641         return ret_conv;
38642 }
38643
38644 jboolean  __attribute__((export_name("TS_InitFeatures_requires_onion_messages"))) TS_InitFeatures_requires_onion_messages(uint64_t this_arg) {
38645         LDKInitFeatures this_arg_conv;
38646         this_arg_conv.inner = untag_ptr(this_arg);
38647         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38648         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38649         this_arg_conv.is_owned = false;
38650         jboolean ret_conv = InitFeatures_requires_onion_messages(&this_arg_conv);
38651         return ret_conv;
38652 }
38653
38654 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_onion_messages"))) TS_NodeFeatures_requires_onion_messages(uint64_t this_arg) {
38655         LDKNodeFeatures this_arg_conv;
38656         this_arg_conv.inner = untag_ptr(this_arg);
38657         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38659         this_arg_conv.is_owned = false;
38660         jboolean ret_conv = NodeFeatures_requires_onion_messages(&this_arg_conv);
38661         return ret_conv;
38662 }
38663
38664 void  __attribute__((export_name("TS_InitFeatures_set_channel_type_optional"))) TS_InitFeatures_set_channel_type_optional(uint64_t this_arg) {
38665         LDKInitFeatures this_arg_conv;
38666         this_arg_conv.inner = untag_ptr(this_arg);
38667         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38669         this_arg_conv.is_owned = false;
38670         InitFeatures_set_channel_type_optional(&this_arg_conv);
38671 }
38672
38673 void  __attribute__((export_name("TS_InitFeatures_set_channel_type_required"))) TS_InitFeatures_set_channel_type_required(uint64_t this_arg) {
38674         LDKInitFeatures this_arg_conv;
38675         this_arg_conv.inner = untag_ptr(this_arg);
38676         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38678         this_arg_conv.is_owned = false;
38679         InitFeatures_set_channel_type_required(&this_arg_conv);
38680 }
38681
38682 jboolean  __attribute__((export_name("TS_InitFeatures_supports_channel_type"))) TS_InitFeatures_supports_channel_type(uint64_t this_arg) {
38683         LDKInitFeatures this_arg_conv;
38684         this_arg_conv.inner = untag_ptr(this_arg);
38685         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38687         this_arg_conv.is_owned = false;
38688         jboolean ret_conv = InitFeatures_supports_channel_type(&this_arg_conv);
38689         return ret_conv;
38690 }
38691
38692 void  __attribute__((export_name("TS_NodeFeatures_set_channel_type_optional"))) TS_NodeFeatures_set_channel_type_optional(uint64_t this_arg) {
38693         LDKNodeFeatures this_arg_conv;
38694         this_arg_conv.inner = untag_ptr(this_arg);
38695         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38697         this_arg_conv.is_owned = false;
38698         NodeFeatures_set_channel_type_optional(&this_arg_conv);
38699 }
38700
38701 void  __attribute__((export_name("TS_NodeFeatures_set_channel_type_required"))) TS_NodeFeatures_set_channel_type_required(uint64_t this_arg) {
38702         LDKNodeFeatures this_arg_conv;
38703         this_arg_conv.inner = untag_ptr(this_arg);
38704         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38706         this_arg_conv.is_owned = false;
38707         NodeFeatures_set_channel_type_required(&this_arg_conv);
38708 }
38709
38710 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_channel_type"))) TS_NodeFeatures_supports_channel_type(uint64_t this_arg) {
38711         LDKNodeFeatures this_arg_conv;
38712         this_arg_conv.inner = untag_ptr(this_arg);
38713         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38715         this_arg_conv.is_owned = false;
38716         jboolean ret_conv = NodeFeatures_supports_channel_type(&this_arg_conv);
38717         return ret_conv;
38718 }
38719
38720 jboolean  __attribute__((export_name("TS_InitFeatures_requires_channel_type"))) TS_InitFeatures_requires_channel_type(uint64_t this_arg) {
38721         LDKInitFeatures this_arg_conv;
38722         this_arg_conv.inner = untag_ptr(this_arg);
38723         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38725         this_arg_conv.is_owned = false;
38726         jboolean ret_conv = InitFeatures_requires_channel_type(&this_arg_conv);
38727         return ret_conv;
38728 }
38729
38730 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_channel_type"))) TS_NodeFeatures_requires_channel_type(uint64_t this_arg) {
38731         LDKNodeFeatures this_arg_conv;
38732         this_arg_conv.inner = untag_ptr(this_arg);
38733         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38735         this_arg_conv.is_owned = false;
38736         jboolean ret_conv = NodeFeatures_requires_channel_type(&this_arg_conv);
38737         return ret_conv;
38738 }
38739
38740 void  __attribute__((export_name("TS_InitFeatures_set_scid_privacy_optional"))) TS_InitFeatures_set_scid_privacy_optional(uint64_t this_arg) {
38741         LDKInitFeatures this_arg_conv;
38742         this_arg_conv.inner = untag_ptr(this_arg);
38743         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38744         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38745         this_arg_conv.is_owned = false;
38746         InitFeatures_set_scid_privacy_optional(&this_arg_conv);
38747 }
38748
38749 void  __attribute__((export_name("TS_InitFeatures_set_scid_privacy_required"))) TS_InitFeatures_set_scid_privacy_required(uint64_t this_arg) {
38750         LDKInitFeatures this_arg_conv;
38751         this_arg_conv.inner = untag_ptr(this_arg);
38752         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38754         this_arg_conv.is_owned = false;
38755         InitFeatures_set_scid_privacy_required(&this_arg_conv);
38756 }
38757
38758 jboolean  __attribute__((export_name("TS_InitFeatures_supports_scid_privacy"))) TS_InitFeatures_supports_scid_privacy(uint64_t this_arg) {
38759         LDKInitFeatures this_arg_conv;
38760         this_arg_conv.inner = untag_ptr(this_arg);
38761         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38763         this_arg_conv.is_owned = false;
38764         jboolean ret_conv = InitFeatures_supports_scid_privacy(&this_arg_conv);
38765         return ret_conv;
38766 }
38767
38768 void  __attribute__((export_name("TS_NodeFeatures_set_scid_privacy_optional"))) TS_NodeFeatures_set_scid_privacy_optional(uint64_t this_arg) {
38769         LDKNodeFeatures this_arg_conv;
38770         this_arg_conv.inner = untag_ptr(this_arg);
38771         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38773         this_arg_conv.is_owned = false;
38774         NodeFeatures_set_scid_privacy_optional(&this_arg_conv);
38775 }
38776
38777 void  __attribute__((export_name("TS_NodeFeatures_set_scid_privacy_required"))) TS_NodeFeatures_set_scid_privacy_required(uint64_t this_arg) {
38778         LDKNodeFeatures this_arg_conv;
38779         this_arg_conv.inner = untag_ptr(this_arg);
38780         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38782         this_arg_conv.is_owned = false;
38783         NodeFeatures_set_scid_privacy_required(&this_arg_conv);
38784 }
38785
38786 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_scid_privacy"))) TS_NodeFeatures_supports_scid_privacy(uint64_t this_arg) {
38787         LDKNodeFeatures this_arg_conv;
38788         this_arg_conv.inner = untag_ptr(this_arg);
38789         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38791         this_arg_conv.is_owned = false;
38792         jboolean ret_conv = NodeFeatures_supports_scid_privacy(&this_arg_conv);
38793         return ret_conv;
38794 }
38795
38796 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_scid_privacy_optional"))) TS_ChannelTypeFeatures_set_scid_privacy_optional(uint64_t this_arg) {
38797         LDKChannelTypeFeatures this_arg_conv;
38798         this_arg_conv.inner = untag_ptr(this_arg);
38799         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38801         this_arg_conv.is_owned = false;
38802         ChannelTypeFeatures_set_scid_privacy_optional(&this_arg_conv);
38803 }
38804
38805 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_scid_privacy_required"))) TS_ChannelTypeFeatures_set_scid_privacy_required(uint64_t this_arg) {
38806         LDKChannelTypeFeatures this_arg_conv;
38807         this_arg_conv.inner = untag_ptr(this_arg);
38808         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38810         this_arg_conv.is_owned = false;
38811         ChannelTypeFeatures_set_scid_privacy_required(&this_arg_conv);
38812 }
38813
38814 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_scid_privacy"))) TS_ChannelTypeFeatures_supports_scid_privacy(uint64_t this_arg) {
38815         LDKChannelTypeFeatures this_arg_conv;
38816         this_arg_conv.inner = untag_ptr(this_arg);
38817         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38819         this_arg_conv.is_owned = false;
38820         jboolean ret_conv = ChannelTypeFeatures_supports_scid_privacy(&this_arg_conv);
38821         return ret_conv;
38822 }
38823
38824 jboolean  __attribute__((export_name("TS_InitFeatures_requires_scid_privacy"))) TS_InitFeatures_requires_scid_privacy(uint64_t this_arg) {
38825         LDKInitFeatures this_arg_conv;
38826         this_arg_conv.inner = untag_ptr(this_arg);
38827         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38829         this_arg_conv.is_owned = false;
38830         jboolean ret_conv = InitFeatures_requires_scid_privacy(&this_arg_conv);
38831         return ret_conv;
38832 }
38833
38834 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_scid_privacy"))) TS_NodeFeatures_requires_scid_privacy(uint64_t this_arg) {
38835         LDKNodeFeatures this_arg_conv;
38836         this_arg_conv.inner = untag_ptr(this_arg);
38837         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38839         this_arg_conv.is_owned = false;
38840         jboolean ret_conv = NodeFeatures_requires_scid_privacy(&this_arg_conv);
38841         return ret_conv;
38842 }
38843
38844 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_scid_privacy"))) TS_ChannelTypeFeatures_requires_scid_privacy(uint64_t this_arg) {
38845         LDKChannelTypeFeatures this_arg_conv;
38846         this_arg_conv.inner = untag_ptr(this_arg);
38847         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38849         this_arg_conv.is_owned = false;
38850         jboolean ret_conv = ChannelTypeFeatures_requires_scid_privacy(&this_arg_conv);
38851         return ret_conv;
38852 }
38853
38854 void  __attribute__((export_name("TS_InitFeatures_set_zero_conf_optional"))) TS_InitFeatures_set_zero_conf_optional(uint64_t this_arg) {
38855         LDKInitFeatures this_arg_conv;
38856         this_arg_conv.inner = untag_ptr(this_arg);
38857         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38859         this_arg_conv.is_owned = false;
38860         InitFeatures_set_zero_conf_optional(&this_arg_conv);
38861 }
38862
38863 void  __attribute__((export_name("TS_InitFeatures_set_zero_conf_required"))) TS_InitFeatures_set_zero_conf_required(uint64_t this_arg) {
38864         LDKInitFeatures this_arg_conv;
38865         this_arg_conv.inner = untag_ptr(this_arg);
38866         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38868         this_arg_conv.is_owned = false;
38869         InitFeatures_set_zero_conf_required(&this_arg_conv);
38870 }
38871
38872 jboolean  __attribute__((export_name("TS_InitFeatures_supports_zero_conf"))) TS_InitFeatures_supports_zero_conf(uint64_t this_arg) {
38873         LDKInitFeatures this_arg_conv;
38874         this_arg_conv.inner = untag_ptr(this_arg);
38875         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38877         this_arg_conv.is_owned = false;
38878         jboolean ret_conv = InitFeatures_supports_zero_conf(&this_arg_conv);
38879         return ret_conv;
38880 }
38881
38882 void  __attribute__((export_name("TS_NodeFeatures_set_zero_conf_optional"))) TS_NodeFeatures_set_zero_conf_optional(uint64_t this_arg) {
38883         LDKNodeFeatures this_arg_conv;
38884         this_arg_conv.inner = untag_ptr(this_arg);
38885         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38887         this_arg_conv.is_owned = false;
38888         NodeFeatures_set_zero_conf_optional(&this_arg_conv);
38889 }
38890
38891 void  __attribute__((export_name("TS_NodeFeatures_set_zero_conf_required"))) TS_NodeFeatures_set_zero_conf_required(uint64_t this_arg) {
38892         LDKNodeFeatures this_arg_conv;
38893         this_arg_conv.inner = untag_ptr(this_arg);
38894         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38896         this_arg_conv.is_owned = false;
38897         NodeFeatures_set_zero_conf_required(&this_arg_conv);
38898 }
38899
38900 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_zero_conf"))) TS_NodeFeatures_supports_zero_conf(uint64_t this_arg) {
38901         LDKNodeFeatures this_arg_conv;
38902         this_arg_conv.inner = untag_ptr(this_arg);
38903         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38905         this_arg_conv.is_owned = false;
38906         jboolean ret_conv = NodeFeatures_supports_zero_conf(&this_arg_conv);
38907         return ret_conv;
38908 }
38909
38910 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_zero_conf_optional"))) TS_ChannelTypeFeatures_set_zero_conf_optional(uint64_t this_arg) {
38911         LDKChannelTypeFeatures this_arg_conv;
38912         this_arg_conv.inner = untag_ptr(this_arg);
38913         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38915         this_arg_conv.is_owned = false;
38916         ChannelTypeFeatures_set_zero_conf_optional(&this_arg_conv);
38917 }
38918
38919 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_zero_conf_required"))) TS_ChannelTypeFeatures_set_zero_conf_required(uint64_t this_arg) {
38920         LDKChannelTypeFeatures this_arg_conv;
38921         this_arg_conv.inner = untag_ptr(this_arg);
38922         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38924         this_arg_conv.is_owned = false;
38925         ChannelTypeFeatures_set_zero_conf_required(&this_arg_conv);
38926 }
38927
38928 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_zero_conf"))) TS_ChannelTypeFeatures_supports_zero_conf(uint64_t this_arg) {
38929         LDKChannelTypeFeatures this_arg_conv;
38930         this_arg_conv.inner = untag_ptr(this_arg);
38931         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38933         this_arg_conv.is_owned = false;
38934         jboolean ret_conv = ChannelTypeFeatures_supports_zero_conf(&this_arg_conv);
38935         return ret_conv;
38936 }
38937
38938 jboolean  __attribute__((export_name("TS_InitFeatures_requires_zero_conf"))) TS_InitFeatures_requires_zero_conf(uint64_t this_arg) {
38939         LDKInitFeatures this_arg_conv;
38940         this_arg_conv.inner = untag_ptr(this_arg);
38941         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38943         this_arg_conv.is_owned = false;
38944         jboolean ret_conv = InitFeatures_requires_zero_conf(&this_arg_conv);
38945         return ret_conv;
38946 }
38947
38948 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_zero_conf"))) TS_NodeFeatures_requires_zero_conf(uint64_t this_arg) {
38949         LDKNodeFeatures this_arg_conv;
38950         this_arg_conv.inner = untag_ptr(this_arg);
38951         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38953         this_arg_conv.is_owned = false;
38954         jboolean ret_conv = NodeFeatures_requires_zero_conf(&this_arg_conv);
38955         return ret_conv;
38956 }
38957
38958 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_zero_conf"))) TS_ChannelTypeFeatures_requires_zero_conf(uint64_t this_arg) {
38959         LDKChannelTypeFeatures this_arg_conv;
38960         this_arg_conv.inner = untag_ptr(this_arg);
38961         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38963         this_arg_conv.is_owned = false;
38964         jboolean ret_conv = ChannelTypeFeatures_requires_zero_conf(&this_arg_conv);
38965         return ret_conv;
38966 }
38967
38968 void  __attribute__((export_name("TS_NodeFeatures_set_keysend_optional"))) TS_NodeFeatures_set_keysend_optional(uint64_t this_arg) {
38969         LDKNodeFeatures this_arg_conv;
38970         this_arg_conv.inner = untag_ptr(this_arg);
38971         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38973         this_arg_conv.is_owned = false;
38974         NodeFeatures_set_keysend_optional(&this_arg_conv);
38975 }
38976
38977 void  __attribute__((export_name("TS_NodeFeatures_set_keysend_required"))) TS_NodeFeatures_set_keysend_required(uint64_t this_arg) {
38978         LDKNodeFeatures this_arg_conv;
38979         this_arg_conv.inner = untag_ptr(this_arg);
38980         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38982         this_arg_conv.is_owned = false;
38983         NodeFeatures_set_keysend_required(&this_arg_conv);
38984 }
38985
38986 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_keysend"))) TS_NodeFeatures_supports_keysend(uint64_t this_arg) {
38987         LDKNodeFeatures this_arg_conv;
38988         this_arg_conv.inner = untag_ptr(this_arg);
38989         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38991         this_arg_conv.is_owned = false;
38992         jboolean ret_conv = NodeFeatures_supports_keysend(&this_arg_conv);
38993         return ret_conv;
38994 }
38995
38996 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_keysend"))) TS_NodeFeatures_requires_keysend(uint64_t this_arg) {
38997         LDKNodeFeatures this_arg_conv;
38998         this_arg_conv.inner = untag_ptr(this_arg);
38999         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39001         this_arg_conv.is_owned = false;
39002         jboolean ret_conv = NodeFeatures_requires_keysend(&this_arg_conv);
39003         return ret_conv;
39004 }
39005
39006 void  __attribute__((export_name("TS_ShutdownScript_free"))) TS_ShutdownScript_free(uint64_t this_obj) {
39007         LDKShutdownScript this_obj_conv;
39008         this_obj_conv.inner = untag_ptr(this_obj);
39009         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39011         ShutdownScript_free(this_obj_conv);
39012 }
39013
39014 static inline uint64_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
39015         LDKShutdownScript ret_var = ShutdownScript_clone(arg);
39016         uint64_t ret_ref = 0;
39017         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39018         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39019         return ret_ref;
39020 }
39021 int64_t  __attribute__((export_name("TS_ShutdownScript_clone_ptr"))) TS_ShutdownScript_clone_ptr(uint64_t arg) {
39022         LDKShutdownScript arg_conv;
39023         arg_conv.inner = untag_ptr(arg);
39024         arg_conv.is_owned = ptr_is_owned(arg);
39025         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39026         arg_conv.is_owned = false;
39027         int64_t ret_conv = ShutdownScript_clone_ptr(&arg_conv);
39028         return ret_conv;
39029 }
39030
39031 uint64_t  __attribute__((export_name("TS_ShutdownScript_clone"))) TS_ShutdownScript_clone(uint64_t orig) {
39032         LDKShutdownScript orig_conv;
39033         orig_conv.inner = untag_ptr(orig);
39034         orig_conv.is_owned = ptr_is_owned(orig);
39035         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39036         orig_conv.is_owned = false;
39037         LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
39038         uint64_t ret_ref = 0;
39039         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39040         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39041         return ret_ref;
39042 }
39043
39044 void  __attribute__((export_name("TS_InvalidShutdownScript_free"))) TS_InvalidShutdownScript_free(uint64_t this_obj) {
39045         LDKInvalidShutdownScript this_obj_conv;
39046         this_obj_conv.inner = untag_ptr(this_obj);
39047         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39049         InvalidShutdownScript_free(this_obj_conv);
39050 }
39051
39052 int8_tArray  __attribute__((export_name("TS_InvalidShutdownScript_get_script"))) TS_InvalidShutdownScript_get_script(uint64_t this_ptr) {
39053         LDKInvalidShutdownScript this_ptr_conv;
39054         this_ptr_conv.inner = untag_ptr(this_ptr);
39055         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39057         this_ptr_conv.is_owned = false;
39058         LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
39059         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39060         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39061         return ret_arr;
39062 }
39063
39064 void  __attribute__((export_name("TS_InvalidShutdownScript_set_script"))) TS_InvalidShutdownScript_set_script(uint64_t this_ptr, int8_tArray val) {
39065         LDKInvalidShutdownScript this_ptr_conv;
39066         this_ptr_conv.inner = untag_ptr(this_ptr);
39067         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39069         this_ptr_conv.is_owned = false;
39070         LDKCVec_u8Z val_ref;
39071         val_ref.datalen = val->arr_len;
39072         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
39073         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
39074         InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
39075 }
39076
39077 uint64_t  __attribute__((export_name("TS_InvalidShutdownScript_new"))) TS_InvalidShutdownScript_new(int8_tArray script_arg) {
39078         LDKCVec_u8Z script_arg_ref;
39079         script_arg_ref.datalen = script_arg->arr_len;
39080         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
39081         memcpy(script_arg_ref.data, script_arg->elems, script_arg_ref.datalen); FREE(script_arg);
39082         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
39083         uint64_t ret_ref = 0;
39084         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39085         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39086         return ret_ref;
39087 }
39088
39089 static inline uint64_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
39090         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
39091         uint64_t ret_ref = 0;
39092         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39093         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39094         return ret_ref;
39095 }
39096 int64_t  __attribute__((export_name("TS_InvalidShutdownScript_clone_ptr"))) TS_InvalidShutdownScript_clone_ptr(uint64_t arg) {
39097         LDKInvalidShutdownScript arg_conv;
39098         arg_conv.inner = untag_ptr(arg);
39099         arg_conv.is_owned = ptr_is_owned(arg);
39100         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39101         arg_conv.is_owned = false;
39102         int64_t ret_conv = InvalidShutdownScript_clone_ptr(&arg_conv);
39103         return ret_conv;
39104 }
39105
39106 uint64_t  __attribute__((export_name("TS_InvalidShutdownScript_clone"))) TS_InvalidShutdownScript_clone(uint64_t orig) {
39107         LDKInvalidShutdownScript orig_conv;
39108         orig_conv.inner = untag_ptr(orig);
39109         orig_conv.is_owned = ptr_is_owned(orig);
39110         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39111         orig_conv.is_owned = false;
39112         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
39113         uint64_t ret_ref = 0;
39114         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39115         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39116         return ret_ref;
39117 }
39118
39119 int8_tArray  __attribute__((export_name("TS_ShutdownScript_write"))) TS_ShutdownScript_write(uint64_t obj) {
39120         LDKShutdownScript obj_conv;
39121         obj_conv.inner = untag_ptr(obj);
39122         obj_conv.is_owned = ptr_is_owned(obj);
39123         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39124         obj_conv.is_owned = false;
39125         LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
39126         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39127         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39128         CVec_u8Z_free(ret_var);
39129         return ret_arr;
39130 }
39131
39132 uint64_t  __attribute__((export_name("TS_ShutdownScript_read"))) TS_ShutdownScript_read(int8_tArray ser) {
39133         LDKu8slice ser_ref;
39134         ser_ref.datalen = ser->arr_len;
39135         ser_ref.data = ser->elems;
39136         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
39137         *ret_conv = ShutdownScript_read(ser_ref);
39138         FREE(ser);
39139         return tag_ptr(ret_conv, true);
39140 }
39141
39142 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_p2wpkh"))) TS_ShutdownScript_new_p2wpkh(int8_tArray pubkey_hash) {
39143         unsigned char pubkey_hash_arr[20];
39144         CHECK(pubkey_hash->arr_len == 20);
39145         memcpy(pubkey_hash_arr, pubkey_hash->elems, 20); FREE(pubkey_hash);
39146         unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
39147         LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
39148         uint64_t ret_ref = 0;
39149         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39150         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39151         return ret_ref;
39152 }
39153
39154 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_p2wsh"))) TS_ShutdownScript_new_p2wsh(int8_tArray script_hash) {
39155         unsigned char script_hash_arr[32];
39156         CHECK(script_hash->arr_len == 32);
39157         memcpy(script_hash_arr, script_hash->elems, 32); FREE(script_hash);
39158         unsigned char (*script_hash_ref)[32] = &script_hash_arr;
39159         LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
39160         uint64_t ret_ref = 0;
39161         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39162         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39163         return ret_ref;
39164 }
39165
39166 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_witness_program"))) TS_ShutdownScript_new_witness_program(int8_t version, int8_tArray program) {
39167         
39168         LDKu8slice program_ref;
39169         program_ref.datalen = program->arr_len;
39170         program_ref.data = program->elems;
39171         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
39172         *ret_conv = ShutdownScript_new_witness_program((LDKWitnessVersion){ ._0 = version }, program_ref);
39173         FREE(program);
39174         return tag_ptr(ret_conv, true);
39175 }
39176
39177 int8_tArray  __attribute__((export_name("TS_ShutdownScript_into_inner"))) TS_ShutdownScript_into_inner(uint64_t this_arg) {
39178         LDKShutdownScript this_arg_conv;
39179         this_arg_conv.inner = untag_ptr(this_arg);
39180         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39182         this_arg_conv = ShutdownScript_clone(&this_arg_conv);
39183         LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
39184         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39185         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39186         CVec_u8Z_free(ret_var);
39187         return ret_arr;
39188 }
39189
39190 int8_tArray  __attribute__((export_name("TS_ShutdownScript_as_legacy_pubkey"))) TS_ShutdownScript_as_legacy_pubkey(uint64_t this_arg) {
39191         LDKShutdownScript this_arg_conv;
39192         this_arg_conv.inner = untag_ptr(this_arg);
39193         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39195         this_arg_conv.is_owned = false;
39196         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
39197         memcpy(ret_arr->elems, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form, 33);
39198         return ret_arr;
39199 }
39200
39201 jboolean  __attribute__((export_name("TS_ShutdownScript_is_compatible"))) TS_ShutdownScript_is_compatible(uint64_t this_arg, uint64_t features) {
39202         LDKShutdownScript this_arg_conv;
39203         this_arg_conv.inner = untag_ptr(this_arg);
39204         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39206         this_arg_conv.is_owned = false;
39207         LDKInitFeatures features_conv;
39208         features_conv.inner = untag_ptr(features);
39209         features_conv.is_owned = ptr_is_owned(features);
39210         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
39211         features_conv.is_owned = false;
39212         jboolean ret_conv = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
39213         return ret_conv;
39214 }
39215
39216 void  __attribute__((export_name("TS_CustomMessageReader_free"))) TS_CustomMessageReader_free(uint64_t this_ptr) {
39217         if (!ptr_is_owned(this_ptr)) return;
39218         void* this_ptr_ptr = untag_ptr(this_ptr);
39219         CHECK_ACCESS(this_ptr_ptr);
39220         LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
39221         FREE(untag_ptr(this_ptr));
39222         CustomMessageReader_free(this_ptr_conv);
39223 }
39224
39225 static inline uint64_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
39226         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
39227         *ret_ret = Type_clone(arg);
39228         return tag_ptr(ret_ret, true);
39229 }
39230 int64_t  __attribute__((export_name("TS_Type_clone_ptr"))) TS_Type_clone_ptr(uint64_t arg) {
39231         void* arg_ptr = untag_ptr(arg);
39232         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
39233         LDKType* arg_conv = (LDKType*)arg_ptr;
39234         int64_t ret_conv = Type_clone_ptr(arg_conv);
39235         return ret_conv;
39236 }
39237
39238 uint64_t  __attribute__((export_name("TS_Type_clone"))) TS_Type_clone(uint64_t orig) {
39239         void* orig_ptr = untag_ptr(orig);
39240         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
39241         LDKType* orig_conv = (LDKType*)orig_ptr;
39242         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
39243         *ret_ret = Type_clone(orig_conv);
39244         return tag_ptr(ret_ret, true);
39245 }
39246
39247 void  __attribute__((export_name("TS_Type_free"))) TS_Type_free(uint64_t this_ptr) {
39248         if (!ptr_is_owned(this_ptr)) return;
39249         void* this_ptr_ptr = untag_ptr(this_ptr);
39250         CHECK_ACCESS(this_ptr_ptr);
39251         LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
39252         FREE(untag_ptr(this_ptr));
39253         Type_free(this_ptr_conv);
39254 }
39255
39256 void  __attribute__((export_name("TS_NodeId_free"))) TS_NodeId_free(uint64_t this_obj) {
39257         LDKNodeId this_obj_conv;
39258         this_obj_conv.inner = untag_ptr(this_obj);
39259         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39261         NodeId_free(this_obj_conv);
39262 }
39263
39264 static inline uint64_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
39265         LDKNodeId ret_var = NodeId_clone(arg);
39266         uint64_t ret_ref = 0;
39267         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39268         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39269         return ret_ref;
39270 }
39271 int64_t  __attribute__((export_name("TS_NodeId_clone_ptr"))) TS_NodeId_clone_ptr(uint64_t arg) {
39272         LDKNodeId arg_conv;
39273         arg_conv.inner = untag_ptr(arg);
39274         arg_conv.is_owned = ptr_is_owned(arg);
39275         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39276         arg_conv.is_owned = false;
39277         int64_t ret_conv = NodeId_clone_ptr(&arg_conv);
39278         return ret_conv;
39279 }
39280
39281 uint64_t  __attribute__((export_name("TS_NodeId_clone"))) TS_NodeId_clone(uint64_t orig) {
39282         LDKNodeId orig_conv;
39283         orig_conv.inner = untag_ptr(orig);
39284         orig_conv.is_owned = ptr_is_owned(orig);
39285         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39286         orig_conv.is_owned = false;
39287         LDKNodeId ret_var = NodeId_clone(&orig_conv);
39288         uint64_t ret_ref = 0;
39289         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39290         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39291         return ret_ref;
39292 }
39293
39294 uint64_t  __attribute__((export_name("TS_NodeId_from_pubkey"))) TS_NodeId_from_pubkey(int8_tArray pubkey) {
39295         LDKPublicKey pubkey_ref;
39296         CHECK(pubkey->arr_len == 33);
39297         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
39298         LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
39299         uint64_t ret_ref = 0;
39300         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39301         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39302         return ret_ref;
39303 }
39304
39305 int8_tArray  __attribute__((export_name("TS_NodeId_as_slice"))) TS_NodeId_as_slice(uint64_t this_arg) {
39306         LDKNodeId this_arg_conv;
39307         this_arg_conv.inner = untag_ptr(this_arg);
39308         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39310         this_arg_conv.is_owned = false;
39311         LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
39312         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39313         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39314         return ret_arr;
39315 }
39316
39317 int64_t  __attribute__((export_name("TS_NodeId_hash"))) TS_NodeId_hash(uint64_t o) {
39318         LDKNodeId o_conv;
39319         o_conv.inner = untag_ptr(o);
39320         o_conv.is_owned = ptr_is_owned(o);
39321         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39322         o_conv.is_owned = false;
39323         int64_t ret_conv = NodeId_hash(&o_conv);
39324         return ret_conv;
39325 }
39326
39327 int8_tArray  __attribute__((export_name("TS_NodeId_write"))) TS_NodeId_write(uint64_t obj) {
39328         LDKNodeId obj_conv;
39329         obj_conv.inner = untag_ptr(obj);
39330         obj_conv.is_owned = ptr_is_owned(obj);
39331         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39332         obj_conv.is_owned = false;
39333         LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
39334         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39335         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39336         CVec_u8Z_free(ret_var);
39337         return ret_arr;
39338 }
39339
39340 uint64_t  __attribute__((export_name("TS_NodeId_read"))) TS_NodeId_read(int8_tArray ser) {
39341         LDKu8slice ser_ref;
39342         ser_ref.datalen = ser->arr_len;
39343         ser_ref.data = ser->elems;
39344         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
39345         *ret_conv = NodeId_read(ser_ref);
39346         FREE(ser);
39347         return tag_ptr(ret_conv, true);
39348 }
39349
39350 void  __attribute__((export_name("TS_NetworkGraph_free"))) TS_NetworkGraph_free(uint64_t this_obj) {
39351         LDKNetworkGraph this_obj_conv;
39352         this_obj_conv.inner = untag_ptr(this_obj);
39353         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39354         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39355         NetworkGraph_free(this_obj_conv);
39356 }
39357
39358 void  __attribute__((export_name("TS_ReadOnlyNetworkGraph_free"))) TS_ReadOnlyNetworkGraph_free(uint64_t this_obj) {
39359         LDKReadOnlyNetworkGraph this_obj_conv;
39360         this_obj_conv.inner = untag_ptr(this_obj);
39361         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39362         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39363         ReadOnlyNetworkGraph_free(this_obj_conv);
39364 }
39365
39366 void  __attribute__((export_name("TS_NetworkUpdate_free"))) TS_NetworkUpdate_free(uint64_t this_ptr) {
39367         if (!ptr_is_owned(this_ptr)) return;
39368         void* this_ptr_ptr = untag_ptr(this_ptr);
39369         CHECK_ACCESS(this_ptr_ptr);
39370         LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
39371         FREE(untag_ptr(this_ptr));
39372         NetworkUpdate_free(this_ptr_conv);
39373 }
39374
39375 static inline uint64_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
39376         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
39377         *ret_copy = NetworkUpdate_clone(arg);
39378         uint64_t ret_ref = tag_ptr(ret_copy, true);
39379         return ret_ref;
39380 }
39381 int64_t  __attribute__((export_name("TS_NetworkUpdate_clone_ptr"))) TS_NetworkUpdate_clone_ptr(uint64_t arg) {
39382         LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)untag_ptr(arg);
39383         int64_t ret_conv = NetworkUpdate_clone_ptr(arg_conv);
39384         return ret_conv;
39385 }
39386
39387 uint64_t  __attribute__((export_name("TS_NetworkUpdate_clone"))) TS_NetworkUpdate_clone(uint64_t orig) {
39388         LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)untag_ptr(orig);
39389         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
39390         *ret_copy = NetworkUpdate_clone(orig_conv);
39391         uint64_t ret_ref = tag_ptr(ret_copy, true);
39392         return ret_ref;
39393 }
39394
39395 uint64_t  __attribute__((export_name("TS_NetworkUpdate_channel_update_message"))) TS_NetworkUpdate_channel_update_message(uint64_t msg) {
39396         LDKChannelUpdate msg_conv;
39397         msg_conv.inner = untag_ptr(msg);
39398         msg_conv.is_owned = ptr_is_owned(msg);
39399         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
39400         msg_conv = ChannelUpdate_clone(&msg_conv);
39401         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
39402         *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
39403         uint64_t ret_ref = tag_ptr(ret_copy, true);
39404         return ret_ref;
39405 }
39406
39407 uint64_t  __attribute__((export_name("TS_NetworkUpdate_channel_failure"))) TS_NetworkUpdate_channel_failure(int64_t short_channel_id, jboolean is_permanent) {
39408         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
39409         *ret_copy = NetworkUpdate_channel_failure(short_channel_id, is_permanent);
39410         uint64_t ret_ref = tag_ptr(ret_copy, true);
39411         return ret_ref;
39412 }
39413
39414 uint64_t  __attribute__((export_name("TS_NetworkUpdate_node_failure"))) TS_NetworkUpdate_node_failure(int8_tArray node_id, jboolean is_permanent) {
39415         LDKPublicKey node_id_ref;
39416         CHECK(node_id->arr_len == 33);
39417         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
39418         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
39419         *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
39420         uint64_t ret_ref = tag_ptr(ret_copy, true);
39421         return ret_ref;
39422 }
39423
39424 int8_tArray  __attribute__((export_name("TS_NetworkUpdate_write"))) TS_NetworkUpdate_write(uint64_t obj) {
39425         LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)untag_ptr(obj);
39426         LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
39427         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39428         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39429         CVec_u8Z_free(ret_var);
39430         return ret_arr;
39431 }
39432
39433 uint64_t  __attribute__((export_name("TS_NetworkUpdate_read"))) TS_NetworkUpdate_read(int8_tArray ser) {
39434         LDKu8slice ser_ref;
39435         ser_ref.datalen = ser->arr_len;
39436         ser_ref.data = ser->elems;
39437         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
39438         *ret_conv = NetworkUpdate_read(ser_ref);
39439         FREE(ser);
39440         return tag_ptr(ret_conv, true);
39441 }
39442
39443 void  __attribute__((export_name("TS_P2PGossipSync_free"))) TS_P2PGossipSync_free(uint64_t this_obj) {
39444         LDKP2PGossipSync this_obj_conv;
39445         this_obj_conv.inner = untag_ptr(this_obj);
39446         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39448         P2PGossipSync_free(this_obj_conv);
39449 }
39450
39451 uint64_t  __attribute__((export_name("TS_P2PGossipSync_new"))) TS_P2PGossipSync_new(uint64_t network_graph, uint64_t chain_access, uint64_t logger) {
39452         LDKNetworkGraph network_graph_conv;
39453         network_graph_conv.inner = untag_ptr(network_graph);
39454         network_graph_conv.is_owned = ptr_is_owned(network_graph);
39455         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
39456         network_graph_conv.is_owned = false;
39457         void* chain_access_ptr = untag_ptr(chain_access);
39458         CHECK_ACCESS(chain_access_ptr);
39459         LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
39460         // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
39461         if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
39462                 // Manually implement clone for Java trait instances
39463                 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
39464                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39465                         LDKAccess_JCalls_cloned(&chain_access_conv.some);
39466                 }
39467         }
39468         void* logger_ptr = untag_ptr(logger);
39469         CHECK_ACCESS(logger_ptr);
39470         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
39471         if (logger_conv.free == LDKLogger_JCalls_free) {
39472                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39473                 LDKLogger_JCalls_cloned(&logger_conv);
39474         }
39475         LDKP2PGossipSync ret_var = P2PGossipSync_new(&network_graph_conv, chain_access_conv, logger_conv);
39476         uint64_t ret_ref = 0;
39477         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39478         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39479         return ret_ref;
39480 }
39481
39482 void  __attribute__((export_name("TS_P2PGossipSync_add_chain_access"))) TS_P2PGossipSync_add_chain_access(uint64_t this_arg, uint64_t chain_access) {
39483         LDKP2PGossipSync this_arg_conv;
39484         this_arg_conv.inner = untag_ptr(this_arg);
39485         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39487         this_arg_conv.is_owned = false;
39488         void* chain_access_ptr = untag_ptr(chain_access);
39489         CHECK_ACCESS(chain_access_ptr);
39490         LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
39491         // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
39492         if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
39493                 // Manually implement clone for Java trait instances
39494                 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
39495                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39496                         LDKAccess_JCalls_cloned(&chain_access_conv.some);
39497                 }
39498         }
39499         P2PGossipSync_add_chain_access(&this_arg_conv, chain_access_conv);
39500 }
39501
39502 uint64_t  __attribute__((export_name("TS_NetworkGraph_as_EventHandler"))) TS_NetworkGraph_as_EventHandler(uint64_t this_arg) {
39503         LDKNetworkGraph this_arg_conv;
39504         this_arg_conv.inner = untag_ptr(this_arg);
39505         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39506         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39507         this_arg_conv.is_owned = false;
39508         LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
39509         *ret_ret = NetworkGraph_as_EventHandler(&this_arg_conv);
39510         return tag_ptr(ret_ret, true);
39511 }
39512
39513 uint64_t  __attribute__((export_name("TS_P2PGossipSync_as_RoutingMessageHandler"))) TS_P2PGossipSync_as_RoutingMessageHandler(uint64_t this_arg) {
39514         LDKP2PGossipSync this_arg_conv;
39515         this_arg_conv.inner = untag_ptr(this_arg);
39516         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39517         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39518         this_arg_conv.is_owned = false;
39519         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
39520         *ret_ret = P2PGossipSync_as_RoutingMessageHandler(&this_arg_conv);
39521         return tag_ptr(ret_ret, true);
39522 }
39523
39524 uint64_t  __attribute__((export_name("TS_P2PGossipSync_as_MessageSendEventsProvider"))) TS_P2PGossipSync_as_MessageSendEventsProvider(uint64_t this_arg) {
39525         LDKP2PGossipSync this_arg_conv;
39526         this_arg_conv.inner = untag_ptr(this_arg);
39527         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39529         this_arg_conv.is_owned = false;
39530         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
39531         *ret_ret = P2PGossipSync_as_MessageSendEventsProvider(&this_arg_conv);
39532         return tag_ptr(ret_ret, true);
39533 }
39534
39535 void  __attribute__((export_name("TS_ChannelUpdateInfo_free"))) TS_ChannelUpdateInfo_free(uint64_t this_obj) {
39536         LDKChannelUpdateInfo this_obj_conv;
39537         this_obj_conv.inner = untag_ptr(this_obj);
39538         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39540         ChannelUpdateInfo_free(this_obj_conv);
39541 }
39542
39543 int32_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_last_update"))) TS_ChannelUpdateInfo_get_last_update(uint64_t this_ptr) {
39544         LDKChannelUpdateInfo this_ptr_conv;
39545         this_ptr_conv.inner = untag_ptr(this_ptr);
39546         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39548         this_ptr_conv.is_owned = false;
39549         int32_t ret_conv = ChannelUpdateInfo_get_last_update(&this_ptr_conv);
39550         return ret_conv;
39551 }
39552
39553 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_last_update"))) TS_ChannelUpdateInfo_set_last_update(uint64_t this_ptr, int32_t val) {
39554         LDKChannelUpdateInfo this_ptr_conv;
39555         this_ptr_conv.inner = untag_ptr(this_ptr);
39556         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39558         this_ptr_conv.is_owned = false;
39559         ChannelUpdateInfo_set_last_update(&this_ptr_conv, val);
39560 }
39561
39562 jboolean  __attribute__((export_name("TS_ChannelUpdateInfo_get_enabled"))) TS_ChannelUpdateInfo_get_enabled(uint64_t this_ptr) {
39563         LDKChannelUpdateInfo this_ptr_conv;
39564         this_ptr_conv.inner = untag_ptr(this_ptr);
39565         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39567         this_ptr_conv.is_owned = false;
39568         jboolean ret_conv = ChannelUpdateInfo_get_enabled(&this_ptr_conv);
39569         return ret_conv;
39570 }
39571
39572 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_enabled"))) TS_ChannelUpdateInfo_set_enabled(uint64_t this_ptr, jboolean val) {
39573         LDKChannelUpdateInfo this_ptr_conv;
39574         this_ptr_conv.inner = untag_ptr(this_ptr);
39575         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39576         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39577         this_ptr_conv.is_owned = false;
39578         ChannelUpdateInfo_set_enabled(&this_ptr_conv, val);
39579 }
39580
39581 int16_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_cltv_expiry_delta"))) TS_ChannelUpdateInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
39582         LDKChannelUpdateInfo this_ptr_conv;
39583         this_ptr_conv.inner = untag_ptr(this_ptr);
39584         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39586         this_ptr_conv.is_owned = false;
39587         int16_t ret_conv = ChannelUpdateInfo_get_cltv_expiry_delta(&this_ptr_conv);
39588         return ret_conv;
39589 }
39590
39591 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_cltv_expiry_delta"))) TS_ChannelUpdateInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
39592         LDKChannelUpdateInfo this_ptr_conv;
39593         this_ptr_conv.inner = untag_ptr(this_ptr);
39594         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39596         this_ptr_conv.is_owned = false;
39597         ChannelUpdateInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
39598 }
39599
39600 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_htlc_minimum_msat"))) TS_ChannelUpdateInfo_get_htlc_minimum_msat(uint64_t this_ptr) {
39601         LDKChannelUpdateInfo this_ptr_conv;
39602         this_ptr_conv.inner = untag_ptr(this_ptr);
39603         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39605         this_ptr_conv.is_owned = false;
39606         int64_t ret_conv = ChannelUpdateInfo_get_htlc_minimum_msat(&this_ptr_conv);
39607         return ret_conv;
39608 }
39609
39610 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_htlc_minimum_msat"))) TS_ChannelUpdateInfo_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
39611         LDKChannelUpdateInfo this_ptr_conv;
39612         this_ptr_conv.inner = untag_ptr(this_ptr);
39613         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39615         this_ptr_conv.is_owned = false;
39616         ChannelUpdateInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
39617 }
39618
39619 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_htlc_maximum_msat"))) TS_ChannelUpdateInfo_get_htlc_maximum_msat(uint64_t this_ptr) {
39620         LDKChannelUpdateInfo this_ptr_conv;
39621         this_ptr_conv.inner = untag_ptr(this_ptr);
39622         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39624         this_ptr_conv.is_owned = false;
39625         int64_t ret_conv = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv);
39626         return ret_conv;
39627 }
39628
39629 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_htlc_maximum_msat"))) TS_ChannelUpdateInfo_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
39630         LDKChannelUpdateInfo this_ptr_conv;
39631         this_ptr_conv.inner = untag_ptr(this_ptr);
39632         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39634         this_ptr_conv.is_owned = false;
39635         ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
39636 }
39637
39638 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_fees"))) TS_ChannelUpdateInfo_get_fees(uint64_t this_ptr) {
39639         LDKChannelUpdateInfo this_ptr_conv;
39640         this_ptr_conv.inner = untag_ptr(this_ptr);
39641         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39643         this_ptr_conv.is_owned = false;
39644         LDKRoutingFees ret_var = ChannelUpdateInfo_get_fees(&this_ptr_conv);
39645         uint64_t ret_ref = 0;
39646         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39647         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39648         return ret_ref;
39649 }
39650
39651 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_fees"))) TS_ChannelUpdateInfo_set_fees(uint64_t this_ptr, uint64_t val) {
39652         LDKChannelUpdateInfo this_ptr_conv;
39653         this_ptr_conv.inner = untag_ptr(this_ptr);
39654         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39656         this_ptr_conv.is_owned = false;
39657         LDKRoutingFees val_conv;
39658         val_conv.inner = untag_ptr(val);
39659         val_conv.is_owned = ptr_is_owned(val);
39660         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39661         val_conv = RoutingFees_clone(&val_conv);
39662         ChannelUpdateInfo_set_fees(&this_ptr_conv, val_conv);
39663 }
39664
39665 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_last_update_message"))) TS_ChannelUpdateInfo_get_last_update_message(uint64_t this_ptr) {
39666         LDKChannelUpdateInfo this_ptr_conv;
39667         this_ptr_conv.inner = untag_ptr(this_ptr);
39668         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39670         this_ptr_conv.is_owned = false;
39671         LDKChannelUpdate ret_var = ChannelUpdateInfo_get_last_update_message(&this_ptr_conv);
39672         uint64_t ret_ref = 0;
39673         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39674         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39675         return ret_ref;
39676 }
39677
39678 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_last_update_message"))) TS_ChannelUpdateInfo_set_last_update_message(uint64_t this_ptr, uint64_t val) {
39679         LDKChannelUpdateInfo this_ptr_conv;
39680         this_ptr_conv.inner = untag_ptr(this_ptr);
39681         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39683         this_ptr_conv.is_owned = false;
39684         LDKChannelUpdate val_conv;
39685         val_conv.inner = untag_ptr(val);
39686         val_conv.is_owned = ptr_is_owned(val);
39687         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39688         val_conv = ChannelUpdate_clone(&val_conv);
39689         ChannelUpdateInfo_set_last_update_message(&this_ptr_conv, val_conv);
39690 }
39691
39692 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) {
39693         LDKRoutingFees fees_arg_conv;
39694         fees_arg_conv.inner = untag_ptr(fees_arg);
39695         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
39696         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
39697         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
39698         LDKChannelUpdate last_update_message_arg_conv;
39699         last_update_message_arg_conv.inner = untag_ptr(last_update_message_arg);
39700         last_update_message_arg_conv.is_owned = ptr_is_owned(last_update_message_arg);
39701         CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
39702         last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
39703         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);
39704         uint64_t ret_ref = 0;
39705         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39706         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39707         return ret_ref;
39708 }
39709
39710 static inline uint64_t ChannelUpdateInfo_clone_ptr(LDKChannelUpdateInfo *NONNULL_PTR arg) {
39711         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(arg);
39712         uint64_t ret_ref = 0;
39713         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39714         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39715         return ret_ref;
39716 }
39717 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_clone_ptr"))) TS_ChannelUpdateInfo_clone_ptr(uint64_t arg) {
39718         LDKChannelUpdateInfo arg_conv;
39719         arg_conv.inner = untag_ptr(arg);
39720         arg_conv.is_owned = ptr_is_owned(arg);
39721         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39722         arg_conv.is_owned = false;
39723         int64_t ret_conv = ChannelUpdateInfo_clone_ptr(&arg_conv);
39724         return ret_conv;
39725 }
39726
39727 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_clone"))) TS_ChannelUpdateInfo_clone(uint64_t orig) {
39728         LDKChannelUpdateInfo orig_conv;
39729         orig_conv.inner = untag_ptr(orig);
39730         orig_conv.is_owned = ptr_is_owned(orig);
39731         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39732         orig_conv.is_owned = false;
39733         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(&orig_conv);
39734         uint64_t ret_ref = 0;
39735         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39736         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39737         return ret_ref;
39738 }
39739
39740 int8_tArray  __attribute__((export_name("TS_ChannelUpdateInfo_write"))) TS_ChannelUpdateInfo_write(uint64_t obj) {
39741         LDKChannelUpdateInfo obj_conv;
39742         obj_conv.inner = untag_ptr(obj);
39743         obj_conv.is_owned = ptr_is_owned(obj);
39744         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39745         obj_conv.is_owned = false;
39746         LDKCVec_u8Z ret_var = ChannelUpdateInfo_write(&obj_conv);
39747         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39748         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39749         CVec_u8Z_free(ret_var);
39750         return ret_arr;
39751 }
39752
39753 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_read"))) TS_ChannelUpdateInfo_read(int8_tArray ser) {
39754         LDKu8slice ser_ref;
39755         ser_ref.datalen = ser->arr_len;
39756         ser_ref.data = ser->elems;
39757         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
39758         *ret_conv = ChannelUpdateInfo_read(ser_ref);
39759         FREE(ser);
39760         return tag_ptr(ret_conv, true);
39761 }
39762
39763 void  __attribute__((export_name("TS_ChannelInfo_free"))) TS_ChannelInfo_free(uint64_t this_obj) {
39764         LDKChannelInfo this_obj_conv;
39765         this_obj_conv.inner = untag_ptr(this_obj);
39766         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39768         ChannelInfo_free(this_obj_conv);
39769 }
39770
39771 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_features"))) TS_ChannelInfo_get_features(uint64_t this_ptr) {
39772         LDKChannelInfo this_ptr_conv;
39773         this_ptr_conv.inner = untag_ptr(this_ptr);
39774         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39776         this_ptr_conv.is_owned = false;
39777         LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
39778         uint64_t ret_ref = 0;
39779         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39780         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39781         return ret_ref;
39782 }
39783
39784 void  __attribute__((export_name("TS_ChannelInfo_set_features"))) TS_ChannelInfo_set_features(uint64_t this_ptr, uint64_t val) {
39785         LDKChannelInfo this_ptr_conv;
39786         this_ptr_conv.inner = untag_ptr(this_ptr);
39787         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39789         this_ptr_conv.is_owned = false;
39790         LDKChannelFeatures val_conv;
39791         val_conv.inner = untag_ptr(val);
39792         val_conv.is_owned = ptr_is_owned(val);
39793         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39794         val_conv = ChannelFeatures_clone(&val_conv);
39795         ChannelInfo_set_features(&this_ptr_conv, val_conv);
39796 }
39797
39798 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_node_one"))) TS_ChannelInfo_get_node_one(uint64_t this_ptr) {
39799         LDKChannelInfo this_ptr_conv;
39800         this_ptr_conv.inner = untag_ptr(this_ptr);
39801         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39802         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39803         this_ptr_conv.is_owned = false;
39804         LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
39805         uint64_t ret_ref = 0;
39806         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39807         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39808         return ret_ref;
39809 }
39810
39811 void  __attribute__((export_name("TS_ChannelInfo_set_node_one"))) TS_ChannelInfo_set_node_one(uint64_t this_ptr, uint64_t val) {
39812         LDKChannelInfo this_ptr_conv;
39813         this_ptr_conv.inner = untag_ptr(this_ptr);
39814         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39816         this_ptr_conv.is_owned = false;
39817         LDKNodeId val_conv;
39818         val_conv.inner = untag_ptr(val);
39819         val_conv.is_owned = ptr_is_owned(val);
39820         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39821         val_conv = NodeId_clone(&val_conv);
39822         ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
39823 }
39824
39825 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_one_to_two"))) TS_ChannelInfo_get_one_to_two(uint64_t this_ptr) {
39826         LDKChannelInfo this_ptr_conv;
39827         this_ptr_conv.inner = untag_ptr(this_ptr);
39828         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39830         this_ptr_conv.is_owned = false;
39831         LDKChannelUpdateInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
39832         uint64_t ret_ref = 0;
39833         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39834         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39835         return ret_ref;
39836 }
39837
39838 void  __attribute__((export_name("TS_ChannelInfo_set_one_to_two"))) TS_ChannelInfo_set_one_to_two(uint64_t this_ptr, uint64_t val) {
39839         LDKChannelInfo this_ptr_conv;
39840         this_ptr_conv.inner = untag_ptr(this_ptr);
39841         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39843         this_ptr_conv.is_owned = false;
39844         LDKChannelUpdateInfo val_conv;
39845         val_conv.inner = untag_ptr(val);
39846         val_conv.is_owned = ptr_is_owned(val);
39847         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39848         val_conv = ChannelUpdateInfo_clone(&val_conv);
39849         ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
39850 }
39851
39852 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_node_two"))) TS_ChannelInfo_get_node_two(uint64_t this_ptr) {
39853         LDKChannelInfo this_ptr_conv;
39854         this_ptr_conv.inner = untag_ptr(this_ptr);
39855         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39857         this_ptr_conv.is_owned = false;
39858         LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
39859         uint64_t ret_ref = 0;
39860         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39861         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39862         return ret_ref;
39863 }
39864
39865 void  __attribute__((export_name("TS_ChannelInfo_set_node_two"))) TS_ChannelInfo_set_node_two(uint64_t this_ptr, uint64_t val) {
39866         LDKChannelInfo this_ptr_conv;
39867         this_ptr_conv.inner = untag_ptr(this_ptr);
39868         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39870         this_ptr_conv.is_owned = false;
39871         LDKNodeId val_conv;
39872         val_conv.inner = untag_ptr(val);
39873         val_conv.is_owned = ptr_is_owned(val);
39874         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39875         val_conv = NodeId_clone(&val_conv);
39876         ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
39877 }
39878
39879 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_two_to_one"))) TS_ChannelInfo_get_two_to_one(uint64_t this_ptr) {
39880         LDKChannelInfo this_ptr_conv;
39881         this_ptr_conv.inner = untag_ptr(this_ptr);
39882         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39883         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39884         this_ptr_conv.is_owned = false;
39885         LDKChannelUpdateInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
39886         uint64_t ret_ref = 0;
39887         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39888         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39889         return ret_ref;
39890 }
39891
39892 void  __attribute__((export_name("TS_ChannelInfo_set_two_to_one"))) TS_ChannelInfo_set_two_to_one(uint64_t this_ptr, uint64_t val) {
39893         LDKChannelInfo this_ptr_conv;
39894         this_ptr_conv.inner = untag_ptr(this_ptr);
39895         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39896         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39897         this_ptr_conv.is_owned = false;
39898         LDKChannelUpdateInfo val_conv;
39899         val_conv.inner = untag_ptr(val);
39900         val_conv.is_owned = ptr_is_owned(val);
39901         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39902         val_conv = ChannelUpdateInfo_clone(&val_conv);
39903         ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
39904 }
39905
39906 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_capacity_sats"))) TS_ChannelInfo_get_capacity_sats(uint64_t this_ptr) {
39907         LDKChannelInfo this_ptr_conv;
39908         this_ptr_conv.inner = untag_ptr(this_ptr);
39909         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39911         this_ptr_conv.is_owned = false;
39912         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
39913         *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
39914         uint64_t ret_ref = tag_ptr(ret_copy, true);
39915         return ret_ref;
39916 }
39917
39918 void  __attribute__((export_name("TS_ChannelInfo_set_capacity_sats"))) TS_ChannelInfo_set_capacity_sats(uint64_t this_ptr, uint64_t val) {
39919         LDKChannelInfo this_ptr_conv;
39920         this_ptr_conv.inner = untag_ptr(this_ptr);
39921         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39923         this_ptr_conv.is_owned = false;
39924         void* val_ptr = untag_ptr(val);
39925         CHECK_ACCESS(val_ptr);
39926         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
39927         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
39928         ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
39929 }
39930
39931 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_announcement_message"))) TS_ChannelInfo_get_announcement_message(uint64_t this_ptr) {
39932         LDKChannelInfo this_ptr_conv;
39933         this_ptr_conv.inner = untag_ptr(this_ptr);
39934         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39936         this_ptr_conv.is_owned = false;
39937         LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
39938         uint64_t ret_ref = 0;
39939         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39940         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39941         return ret_ref;
39942 }
39943
39944 void  __attribute__((export_name("TS_ChannelInfo_set_announcement_message"))) TS_ChannelInfo_set_announcement_message(uint64_t this_ptr, uint64_t val) {
39945         LDKChannelInfo this_ptr_conv;
39946         this_ptr_conv.inner = untag_ptr(this_ptr);
39947         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39949         this_ptr_conv.is_owned = false;
39950         LDKChannelAnnouncement val_conv;
39951         val_conv.inner = untag_ptr(val);
39952         val_conv.is_owned = ptr_is_owned(val);
39953         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39954         val_conv = ChannelAnnouncement_clone(&val_conv);
39955         ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
39956 }
39957
39958 static inline uint64_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
39959         LDKChannelInfo ret_var = ChannelInfo_clone(arg);
39960         uint64_t ret_ref = 0;
39961         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39962         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39963         return ret_ref;
39964 }
39965 int64_t  __attribute__((export_name("TS_ChannelInfo_clone_ptr"))) TS_ChannelInfo_clone_ptr(uint64_t arg) {
39966         LDKChannelInfo arg_conv;
39967         arg_conv.inner = untag_ptr(arg);
39968         arg_conv.is_owned = ptr_is_owned(arg);
39969         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39970         arg_conv.is_owned = false;
39971         int64_t ret_conv = ChannelInfo_clone_ptr(&arg_conv);
39972         return ret_conv;
39973 }
39974
39975 uint64_t  __attribute__((export_name("TS_ChannelInfo_clone"))) TS_ChannelInfo_clone(uint64_t orig) {
39976         LDKChannelInfo orig_conv;
39977         orig_conv.inner = untag_ptr(orig);
39978         orig_conv.is_owned = ptr_is_owned(orig);
39979         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39980         orig_conv.is_owned = false;
39981         LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
39982         uint64_t ret_ref = 0;
39983         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39984         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39985         return ret_ref;
39986 }
39987
39988 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_directional_info"))) TS_ChannelInfo_get_directional_info(uint64_t this_arg, int8_t channel_flags) {
39989         LDKChannelInfo this_arg_conv;
39990         this_arg_conv.inner = untag_ptr(this_arg);
39991         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39993         this_arg_conv.is_owned = false;
39994         LDKChannelUpdateInfo ret_var = ChannelInfo_get_directional_info(&this_arg_conv, channel_flags);
39995         uint64_t ret_ref = 0;
39996         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39997         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39998         return ret_ref;
39999 }
40000
40001 int8_tArray  __attribute__((export_name("TS_ChannelInfo_write"))) TS_ChannelInfo_write(uint64_t obj) {
40002         LDKChannelInfo obj_conv;
40003         obj_conv.inner = untag_ptr(obj);
40004         obj_conv.is_owned = ptr_is_owned(obj);
40005         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40006         obj_conv.is_owned = false;
40007         LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
40008         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40009         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40010         CVec_u8Z_free(ret_var);
40011         return ret_arr;
40012 }
40013
40014 uint64_t  __attribute__((export_name("TS_ChannelInfo_read"))) TS_ChannelInfo_read(int8_tArray ser) {
40015         LDKu8slice ser_ref;
40016         ser_ref.datalen = ser->arr_len;
40017         ser_ref.data = ser->elems;
40018         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
40019         *ret_conv = ChannelInfo_read(ser_ref);
40020         FREE(ser);
40021         return tag_ptr(ret_conv, true);
40022 }
40023
40024 void  __attribute__((export_name("TS_DirectedChannelInfo_free"))) TS_DirectedChannelInfo_free(uint64_t this_obj) {
40025         LDKDirectedChannelInfo this_obj_conv;
40026         this_obj_conv.inner = untag_ptr(this_obj);
40027         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40029         DirectedChannelInfo_free(this_obj_conv);
40030 }
40031
40032 static inline uint64_t DirectedChannelInfo_clone_ptr(LDKDirectedChannelInfo *NONNULL_PTR arg) {
40033         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(arg);
40034         uint64_t ret_ref = 0;
40035         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40036         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40037         return ret_ref;
40038 }
40039 int64_t  __attribute__((export_name("TS_DirectedChannelInfo_clone_ptr"))) TS_DirectedChannelInfo_clone_ptr(uint64_t arg) {
40040         LDKDirectedChannelInfo arg_conv;
40041         arg_conv.inner = untag_ptr(arg);
40042         arg_conv.is_owned = ptr_is_owned(arg);
40043         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40044         arg_conv.is_owned = false;
40045         int64_t ret_conv = DirectedChannelInfo_clone_ptr(&arg_conv);
40046         return ret_conv;
40047 }
40048
40049 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_clone"))) TS_DirectedChannelInfo_clone(uint64_t orig) {
40050         LDKDirectedChannelInfo orig_conv;
40051         orig_conv.inner = untag_ptr(orig);
40052         orig_conv.is_owned = ptr_is_owned(orig);
40053         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40054         orig_conv.is_owned = false;
40055         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(&orig_conv);
40056         uint64_t ret_ref = 0;
40057         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40058         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40059         return ret_ref;
40060 }
40061
40062 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_channel"))) TS_DirectedChannelInfo_channel(uint64_t this_arg) {
40063         LDKDirectedChannelInfo this_arg_conv;
40064         this_arg_conv.inner = untag_ptr(this_arg);
40065         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40067         this_arg_conv.is_owned = false;
40068         LDKChannelInfo ret_var = DirectedChannelInfo_channel(&this_arg_conv);
40069         uint64_t ret_ref = 0;
40070         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40071         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40072         return ret_ref;
40073 }
40074
40075 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_direction"))) TS_DirectedChannelInfo_direction(uint64_t this_arg) {
40076         LDKDirectedChannelInfo this_arg_conv;
40077         this_arg_conv.inner = untag_ptr(this_arg);
40078         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40080         this_arg_conv.is_owned = false;
40081         LDKChannelUpdateInfo ret_var = DirectedChannelInfo_direction(&this_arg_conv);
40082         uint64_t ret_ref = 0;
40083         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40084         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40085         return ret_ref;
40086 }
40087
40088 int64_t  __attribute__((export_name("TS_DirectedChannelInfo_htlc_maximum_msat"))) TS_DirectedChannelInfo_htlc_maximum_msat(uint64_t this_arg) {
40089         LDKDirectedChannelInfo this_arg_conv;
40090         this_arg_conv.inner = untag_ptr(this_arg);
40091         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40093         this_arg_conv.is_owned = false;
40094         int64_t ret_conv = DirectedChannelInfo_htlc_maximum_msat(&this_arg_conv);
40095         return ret_conv;
40096 }
40097
40098 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_effective_capacity"))) TS_DirectedChannelInfo_effective_capacity(uint64_t this_arg) {
40099         LDKDirectedChannelInfo this_arg_conv;
40100         this_arg_conv.inner = untag_ptr(this_arg);
40101         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40103         this_arg_conv.is_owned = false;
40104         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
40105         *ret_copy = DirectedChannelInfo_effective_capacity(&this_arg_conv);
40106         uint64_t ret_ref = tag_ptr(ret_copy, true);
40107         return ret_ref;
40108 }
40109
40110 void  __attribute__((export_name("TS_EffectiveCapacity_free"))) TS_EffectiveCapacity_free(uint64_t this_ptr) {
40111         if (!ptr_is_owned(this_ptr)) return;
40112         void* this_ptr_ptr = untag_ptr(this_ptr);
40113         CHECK_ACCESS(this_ptr_ptr);
40114         LDKEffectiveCapacity this_ptr_conv = *(LDKEffectiveCapacity*)(this_ptr_ptr);
40115         FREE(untag_ptr(this_ptr));
40116         EffectiveCapacity_free(this_ptr_conv);
40117 }
40118
40119 static inline uint64_t EffectiveCapacity_clone_ptr(LDKEffectiveCapacity *NONNULL_PTR arg) {
40120         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
40121         *ret_copy = EffectiveCapacity_clone(arg);
40122         uint64_t ret_ref = tag_ptr(ret_copy, true);
40123         return ret_ref;
40124 }
40125 int64_t  __attribute__((export_name("TS_EffectiveCapacity_clone_ptr"))) TS_EffectiveCapacity_clone_ptr(uint64_t arg) {
40126         LDKEffectiveCapacity* arg_conv = (LDKEffectiveCapacity*)untag_ptr(arg);
40127         int64_t ret_conv = EffectiveCapacity_clone_ptr(arg_conv);
40128         return ret_conv;
40129 }
40130
40131 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_clone"))) TS_EffectiveCapacity_clone(uint64_t orig) {
40132         LDKEffectiveCapacity* orig_conv = (LDKEffectiveCapacity*)untag_ptr(orig);
40133         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
40134         *ret_copy = EffectiveCapacity_clone(orig_conv);
40135         uint64_t ret_ref = tag_ptr(ret_copy, true);
40136         return ret_ref;
40137 }
40138
40139 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_exact_liquidity"))) TS_EffectiveCapacity_exact_liquidity(int64_t liquidity_msat) {
40140         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
40141         *ret_copy = EffectiveCapacity_exact_liquidity(liquidity_msat);
40142         uint64_t ret_ref = tag_ptr(ret_copy, true);
40143         return ret_ref;
40144 }
40145
40146 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_maximum_htlc"))) TS_EffectiveCapacity_maximum_htlc(int64_t amount_msat) {
40147         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
40148         *ret_copy = EffectiveCapacity_maximum_htlc(amount_msat);
40149         uint64_t ret_ref = tag_ptr(ret_copy, true);
40150         return ret_ref;
40151 }
40152
40153 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_total"))) TS_EffectiveCapacity_total(int64_t capacity_msat, uint64_t htlc_maximum_msat) {
40154         void* htlc_maximum_msat_ptr = untag_ptr(htlc_maximum_msat);
40155         CHECK_ACCESS(htlc_maximum_msat_ptr);
40156         LDKCOption_u64Z htlc_maximum_msat_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_ptr);
40157         htlc_maximum_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_maximum_msat));
40158         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
40159         *ret_copy = EffectiveCapacity_total(capacity_msat, htlc_maximum_msat_conv);
40160         uint64_t ret_ref = tag_ptr(ret_copy, true);
40161         return ret_ref;
40162 }
40163
40164 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_infinite"))) TS_EffectiveCapacity_infinite() {
40165         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
40166         *ret_copy = EffectiveCapacity_infinite();
40167         uint64_t ret_ref = tag_ptr(ret_copy, true);
40168         return ret_ref;
40169 }
40170
40171 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_unknown"))) TS_EffectiveCapacity_unknown() {
40172         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
40173         *ret_copy = EffectiveCapacity_unknown();
40174         uint64_t ret_ref = tag_ptr(ret_copy, true);
40175         return ret_ref;
40176 }
40177
40178 int64_t  __attribute__((export_name("TS_EffectiveCapacity_as_msat"))) TS_EffectiveCapacity_as_msat(uint64_t this_arg) {
40179         LDKEffectiveCapacity* this_arg_conv = (LDKEffectiveCapacity*)untag_ptr(this_arg);
40180         int64_t ret_conv = EffectiveCapacity_as_msat(this_arg_conv);
40181         return ret_conv;
40182 }
40183
40184 void  __attribute__((export_name("TS_RoutingFees_free"))) TS_RoutingFees_free(uint64_t this_obj) {
40185         LDKRoutingFees this_obj_conv;
40186         this_obj_conv.inner = untag_ptr(this_obj);
40187         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40189         RoutingFees_free(this_obj_conv);
40190 }
40191
40192 int32_t  __attribute__((export_name("TS_RoutingFees_get_base_msat"))) TS_RoutingFees_get_base_msat(uint64_t this_ptr) {
40193         LDKRoutingFees this_ptr_conv;
40194         this_ptr_conv.inner = untag_ptr(this_ptr);
40195         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40197         this_ptr_conv.is_owned = false;
40198         int32_t ret_conv = RoutingFees_get_base_msat(&this_ptr_conv);
40199         return ret_conv;
40200 }
40201
40202 void  __attribute__((export_name("TS_RoutingFees_set_base_msat"))) TS_RoutingFees_set_base_msat(uint64_t this_ptr, int32_t val) {
40203         LDKRoutingFees this_ptr_conv;
40204         this_ptr_conv.inner = untag_ptr(this_ptr);
40205         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40206         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40207         this_ptr_conv.is_owned = false;
40208         RoutingFees_set_base_msat(&this_ptr_conv, val);
40209 }
40210
40211 int32_t  __attribute__((export_name("TS_RoutingFees_get_proportional_millionths"))) TS_RoutingFees_get_proportional_millionths(uint64_t this_ptr) {
40212         LDKRoutingFees this_ptr_conv;
40213         this_ptr_conv.inner = untag_ptr(this_ptr);
40214         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40216         this_ptr_conv.is_owned = false;
40217         int32_t ret_conv = RoutingFees_get_proportional_millionths(&this_ptr_conv);
40218         return ret_conv;
40219 }
40220
40221 void  __attribute__((export_name("TS_RoutingFees_set_proportional_millionths"))) TS_RoutingFees_set_proportional_millionths(uint64_t this_ptr, int32_t val) {
40222         LDKRoutingFees this_ptr_conv;
40223         this_ptr_conv.inner = untag_ptr(this_ptr);
40224         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40226         this_ptr_conv.is_owned = false;
40227         RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
40228 }
40229
40230 uint64_t  __attribute__((export_name("TS_RoutingFees_new"))) TS_RoutingFees_new(int32_t base_msat_arg, int32_t proportional_millionths_arg) {
40231         LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
40232         uint64_t ret_ref = 0;
40233         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40234         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40235         return ret_ref;
40236 }
40237
40238 jboolean  __attribute__((export_name("TS_RoutingFees_eq"))) TS_RoutingFees_eq(uint64_t a, uint64_t b) {
40239         LDKRoutingFees a_conv;
40240         a_conv.inner = untag_ptr(a);
40241         a_conv.is_owned = ptr_is_owned(a);
40242         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40243         a_conv.is_owned = false;
40244         LDKRoutingFees b_conv;
40245         b_conv.inner = untag_ptr(b);
40246         b_conv.is_owned = ptr_is_owned(b);
40247         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40248         b_conv.is_owned = false;
40249         jboolean ret_conv = RoutingFees_eq(&a_conv, &b_conv);
40250         return ret_conv;
40251 }
40252
40253 static inline uint64_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
40254         LDKRoutingFees ret_var = RoutingFees_clone(arg);
40255         uint64_t ret_ref = 0;
40256         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40257         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40258         return ret_ref;
40259 }
40260 int64_t  __attribute__((export_name("TS_RoutingFees_clone_ptr"))) TS_RoutingFees_clone_ptr(uint64_t arg) {
40261         LDKRoutingFees arg_conv;
40262         arg_conv.inner = untag_ptr(arg);
40263         arg_conv.is_owned = ptr_is_owned(arg);
40264         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40265         arg_conv.is_owned = false;
40266         int64_t ret_conv = RoutingFees_clone_ptr(&arg_conv);
40267         return ret_conv;
40268 }
40269
40270 uint64_t  __attribute__((export_name("TS_RoutingFees_clone"))) TS_RoutingFees_clone(uint64_t orig) {
40271         LDKRoutingFees orig_conv;
40272         orig_conv.inner = untag_ptr(orig);
40273         orig_conv.is_owned = ptr_is_owned(orig);
40274         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40275         orig_conv.is_owned = false;
40276         LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
40277         uint64_t ret_ref = 0;
40278         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40279         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40280         return ret_ref;
40281 }
40282
40283 int64_t  __attribute__((export_name("TS_RoutingFees_hash"))) TS_RoutingFees_hash(uint64_t o) {
40284         LDKRoutingFees o_conv;
40285         o_conv.inner = untag_ptr(o);
40286         o_conv.is_owned = ptr_is_owned(o);
40287         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40288         o_conv.is_owned = false;
40289         int64_t ret_conv = RoutingFees_hash(&o_conv);
40290         return ret_conv;
40291 }
40292
40293 int8_tArray  __attribute__((export_name("TS_RoutingFees_write"))) TS_RoutingFees_write(uint64_t obj) {
40294         LDKRoutingFees obj_conv;
40295         obj_conv.inner = untag_ptr(obj);
40296         obj_conv.is_owned = ptr_is_owned(obj);
40297         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40298         obj_conv.is_owned = false;
40299         LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
40300         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40301         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40302         CVec_u8Z_free(ret_var);
40303         return ret_arr;
40304 }
40305
40306 uint64_t  __attribute__((export_name("TS_RoutingFees_read"))) TS_RoutingFees_read(int8_tArray ser) {
40307         LDKu8slice ser_ref;
40308         ser_ref.datalen = ser->arr_len;
40309         ser_ref.data = ser->elems;
40310         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
40311         *ret_conv = RoutingFees_read(ser_ref);
40312         FREE(ser);
40313         return tag_ptr(ret_conv, true);
40314 }
40315
40316 void  __attribute__((export_name("TS_NodeAnnouncementInfo_free"))) TS_NodeAnnouncementInfo_free(uint64_t this_obj) {
40317         LDKNodeAnnouncementInfo this_obj_conv;
40318         this_obj_conv.inner = untag_ptr(this_obj);
40319         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40321         NodeAnnouncementInfo_free(this_obj_conv);
40322 }
40323
40324 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_features"))) TS_NodeAnnouncementInfo_get_features(uint64_t this_ptr) {
40325         LDKNodeAnnouncementInfo this_ptr_conv;
40326         this_ptr_conv.inner = untag_ptr(this_ptr);
40327         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40329         this_ptr_conv.is_owned = false;
40330         LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
40331         uint64_t ret_ref = 0;
40332         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40333         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40334         return ret_ref;
40335 }
40336
40337 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_features"))) TS_NodeAnnouncementInfo_set_features(uint64_t this_ptr, uint64_t val) {
40338         LDKNodeAnnouncementInfo this_ptr_conv;
40339         this_ptr_conv.inner = untag_ptr(this_ptr);
40340         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40341         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40342         this_ptr_conv.is_owned = false;
40343         LDKNodeFeatures val_conv;
40344         val_conv.inner = untag_ptr(val);
40345         val_conv.is_owned = ptr_is_owned(val);
40346         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40347         val_conv = NodeFeatures_clone(&val_conv);
40348         NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
40349 }
40350
40351 int32_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_last_update"))) TS_NodeAnnouncementInfo_get_last_update(uint64_t this_ptr) {
40352         LDKNodeAnnouncementInfo this_ptr_conv;
40353         this_ptr_conv.inner = untag_ptr(this_ptr);
40354         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40356         this_ptr_conv.is_owned = false;
40357         int32_t ret_conv = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
40358         return ret_conv;
40359 }
40360
40361 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_last_update"))) TS_NodeAnnouncementInfo_set_last_update(uint64_t this_ptr, int32_t val) {
40362         LDKNodeAnnouncementInfo this_ptr_conv;
40363         this_ptr_conv.inner = untag_ptr(this_ptr);
40364         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40366         this_ptr_conv.is_owned = false;
40367         NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
40368 }
40369
40370 int8_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_get_rgb"))) TS_NodeAnnouncementInfo_get_rgb(uint64_t this_ptr) {
40371         LDKNodeAnnouncementInfo this_ptr_conv;
40372         this_ptr_conv.inner = untag_ptr(this_ptr);
40373         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40375         this_ptr_conv.is_owned = false;
40376         int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
40377         memcpy(ret_arr->elems, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3);
40378         return ret_arr;
40379 }
40380
40381 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_rgb"))) TS_NodeAnnouncementInfo_set_rgb(uint64_t this_ptr, int8_tArray val) {
40382         LDKNodeAnnouncementInfo this_ptr_conv;
40383         this_ptr_conv.inner = untag_ptr(this_ptr);
40384         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40386         this_ptr_conv.is_owned = false;
40387         LDKThreeBytes val_ref;
40388         CHECK(val->arr_len == 3);
40389         memcpy(val_ref.data, val->elems, 3); FREE(val);
40390         NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
40391 }
40392
40393 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_alias"))) TS_NodeAnnouncementInfo_get_alias(uint64_t this_ptr) {
40394         LDKNodeAnnouncementInfo this_ptr_conv;
40395         this_ptr_conv.inner = untag_ptr(this_ptr);
40396         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40398         this_ptr_conv.is_owned = false;
40399         LDKNodeAlias ret_var = NodeAnnouncementInfo_get_alias(&this_ptr_conv);
40400         uint64_t ret_ref = 0;
40401         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40402         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40403         return ret_ref;
40404 }
40405
40406 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_alias"))) TS_NodeAnnouncementInfo_set_alias(uint64_t this_ptr, uint64_t val) {
40407         LDKNodeAnnouncementInfo this_ptr_conv;
40408         this_ptr_conv.inner = untag_ptr(this_ptr);
40409         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40411         this_ptr_conv.is_owned = false;
40412         LDKNodeAlias val_conv;
40413         val_conv.inner = untag_ptr(val);
40414         val_conv.is_owned = ptr_is_owned(val);
40415         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40416         val_conv = NodeAlias_clone(&val_conv);
40417         NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_conv);
40418 }
40419
40420 uint64_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_get_addresses"))) TS_NodeAnnouncementInfo_get_addresses(uint64_t this_ptr) {
40421         LDKNodeAnnouncementInfo this_ptr_conv;
40422         this_ptr_conv.inner = untag_ptr(this_ptr);
40423         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40425         this_ptr_conv.is_owned = false;
40426         LDKCVec_NetAddressZ ret_var = NodeAnnouncementInfo_get_addresses(&this_ptr_conv);
40427         uint64_tArray ret_arr = NULL;
40428         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
40429         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
40430         for (size_t m = 0; m < ret_var.datalen; m++) {
40431                 LDKNetAddress *ret_conv_12_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
40432                 *ret_conv_12_copy = ret_var.data[m];
40433                 uint64_t ret_conv_12_ref = tag_ptr(ret_conv_12_copy, true);
40434                 ret_arr_ptr[m] = ret_conv_12_ref;
40435         }
40436         
40437         FREE(ret_var.data);
40438         return ret_arr;
40439 }
40440
40441 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_addresses"))) TS_NodeAnnouncementInfo_set_addresses(uint64_t this_ptr, uint64_tArray val) {
40442         LDKNodeAnnouncementInfo this_ptr_conv;
40443         this_ptr_conv.inner = untag_ptr(this_ptr);
40444         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40446         this_ptr_conv.is_owned = false;
40447         LDKCVec_NetAddressZ val_constr;
40448         val_constr.datalen = val->arr_len;
40449         if (val_constr.datalen > 0)
40450                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
40451         else
40452                 val_constr.data = NULL;
40453         uint64_t* val_vals = val->elems;
40454         for (size_t m = 0; m < val_constr.datalen; m++) {
40455                 uint64_t val_conv_12 = val_vals[m];
40456                 void* val_conv_12_ptr = untag_ptr(val_conv_12);
40457                 CHECK_ACCESS(val_conv_12_ptr);
40458                 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
40459                 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(val_conv_12));
40460                 val_constr.data[m] = val_conv_12_conv;
40461         }
40462         FREE(val);
40463         NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
40464 }
40465
40466 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_announcement_message"))) TS_NodeAnnouncementInfo_get_announcement_message(uint64_t this_ptr) {
40467         LDKNodeAnnouncementInfo this_ptr_conv;
40468         this_ptr_conv.inner = untag_ptr(this_ptr);
40469         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40471         this_ptr_conv.is_owned = false;
40472         LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
40473         uint64_t ret_ref = 0;
40474         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40475         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40476         return ret_ref;
40477 }
40478
40479 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_announcement_message"))) TS_NodeAnnouncementInfo_set_announcement_message(uint64_t this_ptr, uint64_t val) {
40480         LDKNodeAnnouncementInfo this_ptr_conv;
40481         this_ptr_conv.inner = untag_ptr(this_ptr);
40482         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40484         this_ptr_conv.is_owned = false;
40485         LDKNodeAnnouncement val_conv;
40486         val_conv.inner = untag_ptr(val);
40487         val_conv.is_owned = ptr_is_owned(val);
40488         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40489         val_conv = NodeAnnouncement_clone(&val_conv);
40490         NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
40491 }
40492
40493 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) {
40494         LDKNodeFeatures features_arg_conv;
40495         features_arg_conv.inner = untag_ptr(features_arg);
40496         features_arg_conv.is_owned = ptr_is_owned(features_arg);
40497         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
40498         features_arg_conv = NodeFeatures_clone(&features_arg_conv);
40499         LDKThreeBytes rgb_arg_ref;
40500         CHECK(rgb_arg->arr_len == 3);
40501         memcpy(rgb_arg_ref.data, rgb_arg->elems, 3); FREE(rgb_arg);
40502         LDKNodeAlias alias_arg_conv;
40503         alias_arg_conv.inner = untag_ptr(alias_arg);
40504         alias_arg_conv.is_owned = ptr_is_owned(alias_arg);
40505         CHECK_INNER_FIELD_ACCESS_OR_NULL(alias_arg_conv);
40506         alias_arg_conv = NodeAlias_clone(&alias_arg_conv);
40507         LDKCVec_NetAddressZ addresses_arg_constr;
40508         addresses_arg_constr.datalen = addresses_arg->arr_len;
40509         if (addresses_arg_constr.datalen > 0)
40510                 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
40511         else
40512                 addresses_arg_constr.data = NULL;
40513         uint64_t* addresses_arg_vals = addresses_arg->elems;
40514         for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
40515                 uint64_t addresses_arg_conv_12 = addresses_arg_vals[m];
40516                 void* addresses_arg_conv_12_ptr = untag_ptr(addresses_arg_conv_12);
40517                 CHECK_ACCESS(addresses_arg_conv_12_ptr);
40518                 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(addresses_arg_conv_12_ptr);
40519                 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
40520         }
40521         FREE(addresses_arg);
40522         LDKNodeAnnouncement announcement_message_arg_conv;
40523         announcement_message_arg_conv.inner = untag_ptr(announcement_message_arg);
40524         announcement_message_arg_conv.is_owned = ptr_is_owned(announcement_message_arg);
40525         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
40526         announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
40527         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_conv, addresses_arg_constr, announcement_message_arg_conv);
40528         uint64_t ret_ref = 0;
40529         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40530         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40531         return ret_ref;
40532 }
40533
40534 static inline uint64_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
40535         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
40536         uint64_t ret_ref = 0;
40537         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40538         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40539         return ret_ref;
40540 }
40541 int64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_clone_ptr"))) TS_NodeAnnouncementInfo_clone_ptr(uint64_t arg) {
40542         LDKNodeAnnouncementInfo arg_conv;
40543         arg_conv.inner = untag_ptr(arg);
40544         arg_conv.is_owned = ptr_is_owned(arg);
40545         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40546         arg_conv.is_owned = false;
40547         int64_t ret_conv = NodeAnnouncementInfo_clone_ptr(&arg_conv);
40548         return ret_conv;
40549 }
40550
40551 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_clone"))) TS_NodeAnnouncementInfo_clone(uint64_t orig) {
40552         LDKNodeAnnouncementInfo orig_conv;
40553         orig_conv.inner = untag_ptr(orig);
40554         orig_conv.is_owned = ptr_is_owned(orig);
40555         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40556         orig_conv.is_owned = false;
40557         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
40558         uint64_t ret_ref = 0;
40559         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40560         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40561         return ret_ref;
40562 }
40563
40564 int8_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_write"))) TS_NodeAnnouncementInfo_write(uint64_t obj) {
40565         LDKNodeAnnouncementInfo obj_conv;
40566         obj_conv.inner = untag_ptr(obj);
40567         obj_conv.is_owned = ptr_is_owned(obj);
40568         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40569         obj_conv.is_owned = false;
40570         LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
40571         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40572         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40573         CVec_u8Z_free(ret_var);
40574         return ret_arr;
40575 }
40576
40577 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_read"))) TS_NodeAnnouncementInfo_read(int8_tArray ser) {
40578         LDKu8slice ser_ref;
40579         ser_ref.datalen = ser->arr_len;
40580         ser_ref.data = ser->elems;
40581         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
40582         *ret_conv = NodeAnnouncementInfo_read(ser_ref);
40583         FREE(ser);
40584         return tag_ptr(ret_conv, true);
40585 }
40586
40587 void  __attribute__((export_name("TS_NodeAlias_free"))) TS_NodeAlias_free(uint64_t this_obj) {
40588         LDKNodeAlias this_obj_conv;
40589         this_obj_conv.inner = untag_ptr(this_obj);
40590         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40592         NodeAlias_free(this_obj_conv);
40593 }
40594
40595 int8_tArray  __attribute__((export_name("TS_NodeAlias_get_a"))) TS_NodeAlias_get_a(uint64_t this_ptr) {
40596         LDKNodeAlias this_ptr_conv;
40597         this_ptr_conv.inner = untag_ptr(this_ptr);
40598         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40600         this_ptr_conv.is_owned = false;
40601         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40602         memcpy(ret_arr->elems, *NodeAlias_get_a(&this_ptr_conv), 32);
40603         return ret_arr;
40604 }
40605
40606 void  __attribute__((export_name("TS_NodeAlias_set_a"))) TS_NodeAlias_set_a(uint64_t this_ptr, int8_tArray val) {
40607         LDKNodeAlias this_ptr_conv;
40608         this_ptr_conv.inner = untag_ptr(this_ptr);
40609         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40611         this_ptr_conv.is_owned = false;
40612         LDKThirtyTwoBytes val_ref;
40613         CHECK(val->arr_len == 32);
40614         memcpy(val_ref.data, val->elems, 32); FREE(val);
40615         NodeAlias_set_a(&this_ptr_conv, val_ref);
40616 }
40617
40618 uint64_t  __attribute__((export_name("TS_NodeAlias_new"))) TS_NodeAlias_new(int8_tArray a_arg) {
40619         LDKThirtyTwoBytes a_arg_ref;
40620         CHECK(a_arg->arr_len == 32);
40621         memcpy(a_arg_ref.data, a_arg->elems, 32); FREE(a_arg);
40622         LDKNodeAlias ret_var = NodeAlias_new(a_arg_ref);
40623         uint64_t ret_ref = 0;
40624         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40625         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40626         return ret_ref;
40627 }
40628
40629 static inline uint64_t NodeAlias_clone_ptr(LDKNodeAlias *NONNULL_PTR arg) {
40630         LDKNodeAlias ret_var = NodeAlias_clone(arg);
40631         uint64_t ret_ref = 0;
40632         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40633         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40634         return ret_ref;
40635 }
40636 int64_t  __attribute__((export_name("TS_NodeAlias_clone_ptr"))) TS_NodeAlias_clone_ptr(uint64_t arg) {
40637         LDKNodeAlias arg_conv;
40638         arg_conv.inner = untag_ptr(arg);
40639         arg_conv.is_owned = ptr_is_owned(arg);
40640         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40641         arg_conv.is_owned = false;
40642         int64_t ret_conv = NodeAlias_clone_ptr(&arg_conv);
40643         return ret_conv;
40644 }
40645
40646 uint64_t  __attribute__((export_name("TS_NodeAlias_clone"))) TS_NodeAlias_clone(uint64_t orig) {
40647         LDKNodeAlias orig_conv;
40648         orig_conv.inner = untag_ptr(orig);
40649         orig_conv.is_owned = ptr_is_owned(orig);
40650         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40651         orig_conv.is_owned = false;
40652         LDKNodeAlias ret_var = NodeAlias_clone(&orig_conv);
40653         uint64_t ret_ref = 0;
40654         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40655         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40656         return ret_ref;
40657 }
40658
40659 int8_tArray  __attribute__((export_name("TS_NodeAlias_write"))) TS_NodeAlias_write(uint64_t obj) {
40660         LDKNodeAlias obj_conv;
40661         obj_conv.inner = untag_ptr(obj);
40662         obj_conv.is_owned = ptr_is_owned(obj);
40663         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40664         obj_conv.is_owned = false;
40665         LDKCVec_u8Z ret_var = NodeAlias_write(&obj_conv);
40666         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40667         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40668         CVec_u8Z_free(ret_var);
40669         return ret_arr;
40670 }
40671
40672 uint64_t  __attribute__((export_name("TS_NodeAlias_read"))) TS_NodeAlias_read(int8_tArray ser) {
40673         LDKu8slice ser_ref;
40674         ser_ref.datalen = ser->arr_len;
40675         ser_ref.data = ser->elems;
40676         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
40677         *ret_conv = NodeAlias_read(ser_ref);
40678         FREE(ser);
40679         return tag_ptr(ret_conv, true);
40680 }
40681
40682 void  __attribute__((export_name("TS_NodeInfo_free"))) TS_NodeInfo_free(uint64_t this_obj) {
40683         LDKNodeInfo this_obj_conv;
40684         this_obj_conv.inner = untag_ptr(this_obj);
40685         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40687         NodeInfo_free(this_obj_conv);
40688 }
40689
40690 int64_tArray  __attribute__((export_name("TS_NodeInfo_get_channels"))) TS_NodeInfo_get_channels(uint64_t this_ptr) {
40691         LDKNodeInfo this_ptr_conv;
40692         this_ptr_conv.inner = untag_ptr(this_ptr);
40693         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40695         this_ptr_conv.is_owned = false;
40696         LDKCVec_u64Z ret_var = NodeInfo_get_channels(&this_ptr_conv);
40697         int64_tArray ret_arr = NULL;
40698         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
40699         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
40700         for (size_t i = 0; i < ret_var.datalen; i++) {
40701                 int64_t ret_conv_8_conv = ret_var.data[i];
40702                 ret_arr_ptr[i] = ret_conv_8_conv;
40703         }
40704         
40705         FREE(ret_var.data);
40706         return ret_arr;
40707 }
40708
40709 void  __attribute__((export_name("TS_NodeInfo_set_channels"))) TS_NodeInfo_set_channels(uint64_t this_ptr, int64_tArray val) {
40710         LDKNodeInfo this_ptr_conv;
40711         this_ptr_conv.inner = untag_ptr(this_ptr);
40712         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40714         this_ptr_conv.is_owned = false;
40715         LDKCVec_u64Z val_constr;
40716         val_constr.datalen = val->arr_len;
40717         if (val_constr.datalen > 0)
40718                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
40719         else
40720                 val_constr.data = NULL;
40721         int64_t* val_vals = val->elems;
40722         for (size_t i = 0; i < val_constr.datalen; i++) {
40723                 int64_t val_conv_8 = val_vals[i];
40724                 val_constr.data[i] = val_conv_8;
40725         }
40726         FREE(val);
40727         NodeInfo_set_channels(&this_ptr_conv, val_constr);
40728 }
40729
40730 uint64_t  __attribute__((export_name("TS_NodeInfo_get_lowest_inbound_channel_fees"))) TS_NodeInfo_get_lowest_inbound_channel_fees(uint64_t this_ptr) {
40731         LDKNodeInfo this_ptr_conv;
40732         this_ptr_conv.inner = untag_ptr(this_ptr);
40733         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40735         this_ptr_conv.is_owned = false;
40736         LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
40737         uint64_t ret_ref = 0;
40738         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40739         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40740         return ret_ref;
40741 }
40742
40743 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) {
40744         LDKNodeInfo this_ptr_conv;
40745         this_ptr_conv.inner = untag_ptr(this_ptr);
40746         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40747         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40748         this_ptr_conv.is_owned = false;
40749         LDKRoutingFees val_conv;
40750         val_conv.inner = untag_ptr(val);
40751         val_conv.is_owned = ptr_is_owned(val);
40752         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40753         val_conv = RoutingFees_clone(&val_conv);
40754         NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
40755 }
40756
40757 uint64_t  __attribute__((export_name("TS_NodeInfo_get_announcement_info"))) TS_NodeInfo_get_announcement_info(uint64_t this_ptr) {
40758         LDKNodeInfo this_ptr_conv;
40759         this_ptr_conv.inner = untag_ptr(this_ptr);
40760         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40761         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40762         this_ptr_conv.is_owned = false;
40763         LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
40764         uint64_t ret_ref = 0;
40765         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40766         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40767         return ret_ref;
40768 }
40769
40770 void  __attribute__((export_name("TS_NodeInfo_set_announcement_info"))) TS_NodeInfo_set_announcement_info(uint64_t this_ptr, uint64_t val) {
40771         LDKNodeInfo this_ptr_conv;
40772         this_ptr_conv.inner = untag_ptr(this_ptr);
40773         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40775         this_ptr_conv.is_owned = false;
40776         LDKNodeAnnouncementInfo val_conv;
40777         val_conv.inner = untag_ptr(val);
40778         val_conv.is_owned = ptr_is_owned(val);
40779         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40780         val_conv = NodeAnnouncementInfo_clone(&val_conv);
40781         NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
40782 }
40783
40784 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) {
40785         LDKCVec_u64Z channels_arg_constr;
40786         channels_arg_constr.datalen = channels_arg->arr_len;
40787         if (channels_arg_constr.datalen > 0)
40788                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
40789         else
40790                 channels_arg_constr.data = NULL;
40791         int64_t* channels_arg_vals = channels_arg->elems;
40792         for (size_t i = 0; i < channels_arg_constr.datalen; i++) {
40793                 int64_t channels_arg_conv_8 = channels_arg_vals[i];
40794                 channels_arg_constr.data[i] = channels_arg_conv_8;
40795         }
40796         FREE(channels_arg);
40797         LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
40798         lowest_inbound_channel_fees_arg_conv.inner = untag_ptr(lowest_inbound_channel_fees_arg);
40799         lowest_inbound_channel_fees_arg_conv.is_owned = ptr_is_owned(lowest_inbound_channel_fees_arg);
40800         CHECK_INNER_FIELD_ACCESS_OR_NULL(lowest_inbound_channel_fees_arg_conv);
40801         lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
40802         LDKNodeAnnouncementInfo announcement_info_arg_conv;
40803         announcement_info_arg_conv.inner = untag_ptr(announcement_info_arg);
40804         announcement_info_arg_conv.is_owned = ptr_is_owned(announcement_info_arg);
40805         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
40806         announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
40807         LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
40808         uint64_t ret_ref = 0;
40809         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40810         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40811         return ret_ref;
40812 }
40813
40814 static inline uint64_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
40815         LDKNodeInfo ret_var = NodeInfo_clone(arg);
40816         uint64_t ret_ref = 0;
40817         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40818         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40819         return ret_ref;
40820 }
40821 int64_t  __attribute__((export_name("TS_NodeInfo_clone_ptr"))) TS_NodeInfo_clone_ptr(uint64_t arg) {
40822         LDKNodeInfo arg_conv;
40823         arg_conv.inner = untag_ptr(arg);
40824         arg_conv.is_owned = ptr_is_owned(arg);
40825         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40826         arg_conv.is_owned = false;
40827         int64_t ret_conv = NodeInfo_clone_ptr(&arg_conv);
40828         return ret_conv;
40829 }
40830
40831 uint64_t  __attribute__((export_name("TS_NodeInfo_clone"))) TS_NodeInfo_clone(uint64_t orig) {
40832         LDKNodeInfo orig_conv;
40833         orig_conv.inner = untag_ptr(orig);
40834         orig_conv.is_owned = ptr_is_owned(orig);
40835         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40836         orig_conv.is_owned = false;
40837         LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
40838         uint64_t ret_ref = 0;
40839         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40840         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40841         return ret_ref;
40842 }
40843
40844 int8_tArray  __attribute__((export_name("TS_NodeInfo_write"))) TS_NodeInfo_write(uint64_t obj) {
40845         LDKNodeInfo obj_conv;
40846         obj_conv.inner = untag_ptr(obj);
40847         obj_conv.is_owned = ptr_is_owned(obj);
40848         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40849         obj_conv.is_owned = false;
40850         LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
40851         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40852         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40853         CVec_u8Z_free(ret_var);
40854         return ret_arr;
40855 }
40856
40857 uint64_t  __attribute__((export_name("TS_NodeInfo_read"))) TS_NodeInfo_read(int8_tArray ser) {
40858         LDKu8slice ser_ref;
40859         ser_ref.datalen = ser->arr_len;
40860         ser_ref.data = ser->elems;
40861         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
40862         *ret_conv = NodeInfo_read(ser_ref);
40863         FREE(ser);
40864         return tag_ptr(ret_conv, true);
40865 }
40866
40867 int8_tArray  __attribute__((export_name("TS_NetworkGraph_write"))) TS_NetworkGraph_write(uint64_t obj) {
40868         LDKNetworkGraph obj_conv;
40869         obj_conv.inner = untag_ptr(obj);
40870         obj_conv.is_owned = ptr_is_owned(obj);
40871         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40872         obj_conv.is_owned = false;
40873         LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
40874         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40875         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40876         CVec_u8Z_free(ret_var);
40877         return ret_arr;
40878 }
40879
40880 uint64_t  __attribute__((export_name("TS_NetworkGraph_read"))) TS_NetworkGraph_read(int8_tArray ser, uint64_t arg) {
40881         LDKu8slice ser_ref;
40882         ser_ref.datalen = ser->arr_len;
40883         ser_ref.data = ser->elems;
40884         void* arg_ptr = untag_ptr(arg);
40885         CHECK_ACCESS(arg_ptr);
40886         LDKLogger arg_conv = *(LDKLogger*)(arg_ptr);
40887         if (arg_conv.free == LDKLogger_JCalls_free) {
40888                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40889                 LDKLogger_JCalls_cloned(&arg_conv);
40890         }
40891         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
40892         *ret_conv = NetworkGraph_read(ser_ref, arg_conv);
40893         FREE(ser);
40894         return tag_ptr(ret_conv, true);
40895 }
40896
40897 uint64_t  __attribute__((export_name("TS_NetworkGraph_new"))) TS_NetworkGraph_new(int8_tArray genesis_hash, uint64_t logger) {
40898         LDKThirtyTwoBytes genesis_hash_ref;
40899         CHECK(genesis_hash->arr_len == 32);
40900         memcpy(genesis_hash_ref.data, genesis_hash->elems, 32); FREE(genesis_hash);
40901         void* logger_ptr = untag_ptr(logger);
40902         CHECK_ACCESS(logger_ptr);
40903         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
40904         if (logger_conv.free == LDKLogger_JCalls_free) {
40905                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40906                 LDKLogger_JCalls_cloned(&logger_conv);
40907         }
40908         LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref, logger_conv);
40909         uint64_t ret_ref = 0;
40910         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40911         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40912         return ret_ref;
40913 }
40914
40915 uint64_t  __attribute__((export_name("TS_NetworkGraph_read_only"))) TS_NetworkGraph_read_only(uint64_t this_arg) {
40916         LDKNetworkGraph this_arg_conv;
40917         this_arg_conv.inner = untag_ptr(this_arg);
40918         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40920         this_arg_conv.is_owned = false;
40921         LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
40922         uint64_t ret_ref = 0;
40923         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40924         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40925         return ret_ref;
40926 }
40927
40928 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) {
40929         LDKNetworkGraph this_arg_conv;
40930         this_arg_conv.inner = untag_ptr(this_arg);
40931         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40933         this_arg_conv.is_owned = false;
40934         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
40935         *ret_copy = NetworkGraph_get_last_rapid_gossip_sync_timestamp(&this_arg_conv);
40936         uint64_t ret_ref = tag_ptr(ret_copy, true);
40937         return ret_ref;
40938 }
40939
40940 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) {
40941         LDKNetworkGraph this_arg_conv;
40942         this_arg_conv.inner = untag_ptr(this_arg);
40943         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40945         this_arg_conv.is_owned = false;
40946         NetworkGraph_set_last_rapid_gossip_sync_timestamp(&this_arg_conv, last_rapid_gossip_sync_timestamp);
40947 }
40948
40949 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_node_from_announcement"))) TS_NetworkGraph_update_node_from_announcement(uint64_t this_arg, uint64_t msg) {
40950         LDKNetworkGraph this_arg_conv;
40951         this_arg_conv.inner = untag_ptr(this_arg);
40952         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40954         this_arg_conv.is_owned = false;
40955         LDKNodeAnnouncement msg_conv;
40956         msg_conv.inner = untag_ptr(msg);
40957         msg_conv.is_owned = ptr_is_owned(msg);
40958         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
40959         msg_conv.is_owned = false;
40960         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
40961         *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
40962         return tag_ptr(ret_conv, true);
40963 }
40964
40965 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) {
40966         LDKNetworkGraph this_arg_conv;
40967         this_arg_conv.inner = untag_ptr(this_arg);
40968         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40970         this_arg_conv.is_owned = false;
40971         LDKUnsignedNodeAnnouncement msg_conv;
40972         msg_conv.inner = untag_ptr(msg);
40973         msg_conv.is_owned = ptr_is_owned(msg);
40974         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
40975         msg_conv.is_owned = false;
40976         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
40977         *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
40978         return tag_ptr(ret_conv, true);
40979 }
40980
40981 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) {
40982         LDKNetworkGraph this_arg_conv;
40983         this_arg_conv.inner = untag_ptr(this_arg);
40984         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40986         this_arg_conv.is_owned = false;
40987         LDKChannelAnnouncement msg_conv;
40988         msg_conv.inner = untag_ptr(msg);
40989         msg_conv.is_owned = ptr_is_owned(msg);
40990         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
40991         msg_conv.is_owned = false;
40992         void* chain_access_ptr = untag_ptr(chain_access);
40993         CHECK_ACCESS(chain_access_ptr);
40994         LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
40995         // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
40996         if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
40997                 // Manually implement clone for Java trait instances
40998                 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
40999                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41000                         LDKAccess_JCalls_cloned(&chain_access_conv.some);
41001                 }
41002         }
41003         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
41004         *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
41005         return tag_ptr(ret_conv, true);
41006 }
41007
41008 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) {
41009         LDKNetworkGraph this_arg_conv;
41010         this_arg_conv.inner = untag_ptr(this_arg);
41011         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41013         this_arg_conv.is_owned = false;
41014         LDKUnsignedChannelAnnouncement msg_conv;
41015         msg_conv.inner = untag_ptr(msg);
41016         msg_conv.is_owned = ptr_is_owned(msg);
41017         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
41018         msg_conv.is_owned = false;
41019         void* chain_access_ptr = untag_ptr(chain_access);
41020         CHECK_ACCESS(chain_access_ptr);
41021         LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
41022         // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
41023         if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
41024                 // Manually implement clone for Java trait instances
41025                 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
41026                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41027                         LDKAccess_JCalls_cloned(&chain_access_conv.some);
41028                 }
41029         }
41030         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
41031         *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
41032         return tag_ptr(ret_conv, true);
41033 }
41034
41035 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) {
41036         LDKNetworkGraph this_arg_conv;
41037         this_arg_conv.inner = untag_ptr(this_arg);
41038         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41040         this_arg_conv.is_owned = false;
41041         LDKChannelFeatures features_conv;
41042         features_conv.inner = untag_ptr(features);
41043         features_conv.is_owned = ptr_is_owned(features);
41044         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
41045         features_conv = ChannelFeatures_clone(&features_conv);
41046         LDKPublicKey node_id_1_ref;
41047         CHECK(node_id_1->arr_len == 33);
41048         memcpy(node_id_1_ref.compressed_form, node_id_1->elems, 33); FREE(node_id_1);
41049         LDKPublicKey node_id_2_ref;
41050         CHECK(node_id_2->arr_len == 33);
41051         memcpy(node_id_2_ref.compressed_form, node_id_2->elems, 33); FREE(node_id_2);
41052         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
41053         *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);
41054         return tag_ptr(ret_conv, true);
41055 }
41056
41057 void  __attribute__((export_name("TS_NetworkGraph_channel_failed"))) TS_NetworkGraph_channel_failed(uint64_t this_arg, int64_t short_channel_id, jboolean is_permanent) {
41058         LDKNetworkGraph this_arg_conv;
41059         this_arg_conv.inner = untag_ptr(this_arg);
41060         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41062         this_arg_conv.is_owned = false;
41063         NetworkGraph_channel_failed(&this_arg_conv, short_channel_id, is_permanent);
41064 }
41065
41066 void  __attribute__((export_name("TS_NetworkGraph_node_failed"))) TS_NetworkGraph_node_failed(uint64_t this_arg, int8_tArray _node_id, jboolean is_permanent) {
41067         LDKNetworkGraph this_arg_conv;
41068         this_arg_conv.inner = untag_ptr(this_arg);
41069         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41071         this_arg_conv.is_owned = false;
41072         LDKPublicKey _node_id_ref;
41073         CHECK(_node_id->arr_len == 33);
41074         memcpy(_node_id_ref.compressed_form, _node_id->elems, 33); FREE(_node_id);
41075         NetworkGraph_node_failed(&this_arg_conv, _node_id_ref, is_permanent);
41076 }
41077
41078 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) {
41079         LDKNetworkGraph this_arg_conv;
41080         this_arg_conv.inner = untag_ptr(this_arg);
41081         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41083         this_arg_conv.is_owned = false;
41084         NetworkGraph_remove_stale_channels_with_time(&this_arg_conv, current_time_unix);
41085 }
41086
41087 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_channel"))) TS_NetworkGraph_update_channel(uint64_t this_arg, uint64_t msg) {
41088         LDKNetworkGraph this_arg_conv;
41089         this_arg_conv.inner = untag_ptr(this_arg);
41090         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41092         this_arg_conv.is_owned = false;
41093         LDKChannelUpdate msg_conv;
41094         msg_conv.inner = untag_ptr(msg);
41095         msg_conv.is_owned = ptr_is_owned(msg);
41096         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
41097         msg_conv.is_owned = false;
41098         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
41099         *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
41100         return tag_ptr(ret_conv, true);
41101 }
41102
41103 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_channel_unsigned"))) TS_NetworkGraph_update_channel_unsigned(uint64_t this_arg, uint64_t msg) {
41104         LDKNetworkGraph this_arg_conv;
41105         this_arg_conv.inner = untag_ptr(this_arg);
41106         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41108         this_arg_conv.is_owned = false;
41109         LDKUnsignedChannelUpdate msg_conv;
41110         msg_conv.inner = untag_ptr(msg);
41111         msg_conv.is_owned = ptr_is_owned(msg);
41112         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
41113         msg_conv.is_owned = false;
41114         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
41115         *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
41116         return tag_ptr(ret_conv, true);
41117 }
41118
41119 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_channel"))) TS_ReadOnlyNetworkGraph_channel(uint64_t this_arg, int64_t short_channel_id) {
41120         LDKReadOnlyNetworkGraph this_arg_conv;
41121         this_arg_conv.inner = untag_ptr(this_arg);
41122         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41124         this_arg_conv.is_owned = false;
41125         LDKChannelInfo ret_var = ReadOnlyNetworkGraph_channel(&this_arg_conv, short_channel_id);
41126         uint64_t ret_ref = 0;
41127         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41128         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41129         return ret_ref;
41130 }
41131
41132 int64_tArray  __attribute__((export_name("TS_ReadOnlyNetworkGraph_list_channels"))) TS_ReadOnlyNetworkGraph_list_channels(uint64_t this_arg) {
41133         LDKReadOnlyNetworkGraph this_arg_conv;
41134         this_arg_conv.inner = untag_ptr(this_arg);
41135         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41137         this_arg_conv.is_owned = false;
41138         LDKCVec_u64Z ret_var = ReadOnlyNetworkGraph_list_channels(&this_arg_conv);
41139         int64_tArray ret_arr = NULL;
41140         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
41141         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
41142         for (size_t i = 0; i < ret_var.datalen; i++) {
41143                 int64_t ret_conv_8_conv = ret_var.data[i];
41144                 ret_arr_ptr[i] = ret_conv_8_conv;
41145         }
41146         
41147         FREE(ret_var.data);
41148         return ret_arr;
41149 }
41150
41151 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_node"))) TS_ReadOnlyNetworkGraph_node(uint64_t this_arg, uint64_t node_id) {
41152         LDKReadOnlyNetworkGraph this_arg_conv;
41153         this_arg_conv.inner = untag_ptr(this_arg);
41154         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41156         this_arg_conv.is_owned = false;
41157         LDKNodeId node_id_conv;
41158         node_id_conv.inner = untag_ptr(node_id);
41159         node_id_conv.is_owned = ptr_is_owned(node_id);
41160         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
41161         node_id_conv.is_owned = false;
41162         LDKNodeInfo ret_var = ReadOnlyNetworkGraph_node(&this_arg_conv, &node_id_conv);
41163         uint64_t ret_ref = 0;
41164         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41165         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41166         return ret_ref;
41167 }
41168
41169 uint64_tArray  __attribute__((export_name("TS_ReadOnlyNetworkGraph_list_nodes"))) TS_ReadOnlyNetworkGraph_list_nodes(uint64_t this_arg) {
41170         LDKReadOnlyNetworkGraph this_arg_conv;
41171         this_arg_conv.inner = untag_ptr(this_arg);
41172         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41174         this_arg_conv.is_owned = false;
41175         LDKCVec_NodeIdZ ret_var = ReadOnlyNetworkGraph_list_nodes(&this_arg_conv);
41176         uint64_tArray ret_arr = NULL;
41177         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
41178         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
41179         for (size_t i = 0; i < ret_var.datalen; i++) {
41180                 LDKNodeId ret_conv_8_var = ret_var.data[i];
41181                 uint64_t ret_conv_8_ref = 0;
41182                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_8_var);
41183                 ret_conv_8_ref = tag_ptr(ret_conv_8_var.inner, ret_conv_8_var.is_owned);
41184                 ret_arr_ptr[i] = ret_conv_8_ref;
41185         }
41186         
41187         FREE(ret_var.data);
41188         return ret_arr;
41189 }
41190
41191 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_get_addresses"))) TS_ReadOnlyNetworkGraph_get_addresses(uint64_t this_arg, int8_tArray pubkey) {
41192         LDKReadOnlyNetworkGraph this_arg_conv;
41193         this_arg_conv.inner = untag_ptr(this_arg);
41194         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41196         this_arg_conv.is_owned = false;
41197         LDKPublicKey pubkey_ref;
41198         CHECK(pubkey->arr_len == 33);
41199         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
41200         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
41201         *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
41202         uint64_t ret_ref = tag_ptr(ret_copy, true);
41203         return ret_ref;
41204 }
41205
41206 void  __attribute__((export_name("TS_RouteHop_free"))) TS_RouteHop_free(uint64_t this_obj) {
41207         LDKRouteHop this_obj_conv;
41208         this_obj_conv.inner = untag_ptr(this_obj);
41209         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41211         RouteHop_free(this_obj_conv);
41212 }
41213
41214 int8_tArray  __attribute__((export_name("TS_RouteHop_get_pubkey"))) TS_RouteHop_get_pubkey(uint64_t this_ptr) {
41215         LDKRouteHop this_ptr_conv;
41216         this_ptr_conv.inner = untag_ptr(this_ptr);
41217         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41219         this_ptr_conv.is_owned = false;
41220         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
41221         memcpy(ret_arr->elems, RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
41222         return ret_arr;
41223 }
41224
41225 void  __attribute__((export_name("TS_RouteHop_set_pubkey"))) TS_RouteHop_set_pubkey(uint64_t this_ptr, int8_tArray val) {
41226         LDKRouteHop this_ptr_conv;
41227         this_ptr_conv.inner = untag_ptr(this_ptr);
41228         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41230         this_ptr_conv.is_owned = false;
41231         LDKPublicKey val_ref;
41232         CHECK(val->arr_len == 33);
41233         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
41234         RouteHop_set_pubkey(&this_ptr_conv, val_ref);
41235 }
41236
41237 uint64_t  __attribute__((export_name("TS_RouteHop_get_node_features"))) TS_RouteHop_get_node_features(uint64_t this_ptr) {
41238         LDKRouteHop this_ptr_conv;
41239         this_ptr_conv.inner = untag_ptr(this_ptr);
41240         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41242         this_ptr_conv.is_owned = false;
41243         LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
41244         uint64_t ret_ref = 0;
41245         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41246         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41247         return ret_ref;
41248 }
41249
41250 void  __attribute__((export_name("TS_RouteHop_set_node_features"))) TS_RouteHop_set_node_features(uint64_t this_ptr, uint64_t val) {
41251         LDKRouteHop this_ptr_conv;
41252         this_ptr_conv.inner = untag_ptr(this_ptr);
41253         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41255         this_ptr_conv.is_owned = false;
41256         LDKNodeFeatures val_conv;
41257         val_conv.inner = untag_ptr(val);
41258         val_conv.is_owned = ptr_is_owned(val);
41259         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41260         val_conv = NodeFeatures_clone(&val_conv);
41261         RouteHop_set_node_features(&this_ptr_conv, val_conv);
41262 }
41263
41264 int64_t  __attribute__((export_name("TS_RouteHop_get_short_channel_id"))) TS_RouteHop_get_short_channel_id(uint64_t this_ptr) {
41265         LDKRouteHop this_ptr_conv;
41266         this_ptr_conv.inner = untag_ptr(this_ptr);
41267         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41269         this_ptr_conv.is_owned = false;
41270         int64_t ret_conv = RouteHop_get_short_channel_id(&this_ptr_conv);
41271         return ret_conv;
41272 }
41273
41274 void  __attribute__((export_name("TS_RouteHop_set_short_channel_id"))) TS_RouteHop_set_short_channel_id(uint64_t this_ptr, int64_t val) {
41275         LDKRouteHop this_ptr_conv;
41276         this_ptr_conv.inner = untag_ptr(this_ptr);
41277         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41279         this_ptr_conv.is_owned = false;
41280         RouteHop_set_short_channel_id(&this_ptr_conv, val);
41281 }
41282
41283 uint64_t  __attribute__((export_name("TS_RouteHop_get_channel_features"))) TS_RouteHop_get_channel_features(uint64_t this_ptr) {
41284         LDKRouteHop this_ptr_conv;
41285         this_ptr_conv.inner = untag_ptr(this_ptr);
41286         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41288         this_ptr_conv.is_owned = false;
41289         LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
41290         uint64_t ret_ref = 0;
41291         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41292         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41293         return ret_ref;
41294 }
41295
41296 void  __attribute__((export_name("TS_RouteHop_set_channel_features"))) TS_RouteHop_set_channel_features(uint64_t this_ptr, uint64_t val) {
41297         LDKRouteHop this_ptr_conv;
41298         this_ptr_conv.inner = untag_ptr(this_ptr);
41299         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41301         this_ptr_conv.is_owned = false;
41302         LDKChannelFeatures val_conv;
41303         val_conv.inner = untag_ptr(val);
41304         val_conv.is_owned = ptr_is_owned(val);
41305         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41306         val_conv = ChannelFeatures_clone(&val_conv);
41307         RouteHop_set_channel_features(&this_ptr_conv, val_conv);
41308 }
41309
41310 int64_t  __attribute__((export_name("TS_RouteHop_get_fee_msat"))) TS_RouteHop_get_fee_msat(uint64_t this_ptr) {
41311         LDKRouteHop this_ptr_conv;
41312         this_ptr_conv.inner = untag_ptr(this_ptr);
41313         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41315         this_ptr_conv.is_owned = false;
41316         int64_t ret_conv = RouteHop_get_fee_msat(&this_ptr_conv);
41317         return ret_conv;
41318 }
41319
41320 void  __attribute__((export_name("TS_RouteHop_set_fee_msat"))) TS_RouteHop_set_fee_msat(uint64_t this_ptr, int64_t val) {
41321         LDKRouteHop this_ptr_conv;
41322         this_ptr_conv.inner = untag_ptr(this_ptr);
41323         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41325         this_ptr_conv.is_owned = false;
41326         RouteHop_set_fee_msat(&this_ptr_conv, val);
41327 }
41328
41329 int32_t  __attribute__((export_name("TS_RouteHop_get_cltv_expiry_delta"))) TS_RouteHop_get_cltv_expiry_delta(uint64_t this_ptr) {
41330         LDKRouteHop this_ptr_conv;
41331         this_ptr_conv.inner = untag_ptr(this_ptr);
41332         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41333         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41334         this_ptr_conv.is_owned = false;
41335         int32_t ret_conv = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
41336         return ret_conv;
41337 }
41338
41339 void  __attribute__((export_name("TS_RouteHop_set_cltv_expiry_delta"))) TS_RouteHop_set_cltv_expiry_delta(uint64_t this_ptr, int32_t val) {
41340         LDKRouteHop this_ptr_conv;
41341         this_ptr_conv.inner = untag_ptr(this_ptr);
41342         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41344         this_ptr_conv.is_owned = false;
41345         RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
41346 }
41347
41348 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) {
41349         LDKPublicKey pubkey_arg_ref;
41350         CHECK(pubkey_arg->arr_len == 33);
41351         memcpy(pubkey_arg_ref.compressed_form, pubkey_arg->elems, 33); FREE(pubkey_arg);
41352         LDKNodeFeatures node_features_arg_conv;
41353         node_features_arg_conv.inner = untag_ptr(node_features_arg);
41354         node_features_arg_conv.is_owned = ptr_is_owned(node_features_arg);
41355         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
41356         node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
41357         LDKChannelFeatures channel_features_arg_conv;
41358         channel_features_arg_conv.inner = untag_ptr(channel_features_arg);
41359         channel_features_arg_conv.is_owned = ptr_is_owned(channel_features_arg);
41360         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
41361         channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
41362         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);
41363         uint64_t ret_ref = 0;
41364         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41365         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41366         return ret_ref;
41367 }
41368
41369 static inline uint64_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
41370         LDKRouteHop ret_var = RouteHop_clone(arg);
41371         uint64_t ret_ref = 0;
41372         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41373         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41374         return ret_ref;
41375 }
41376 int64_t  __attribute__((export_name("TS_RouteHop_clone_ptr"))) TS_RouteHop_clone_ptr(uint64_t arg) {
41377         LDKRouteHop arg_conv;
41378         arg_conv.inner = untag_ptr(arg);
41379         arg_conv.is_owned = ptr_is_owned(arg);
41380         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41381         arg_conv.is_owned = false;
41382         int64_t ret_conv = RouteHop_clone_ptr(&arg_conv);
41383         return ret_conv;
41384 }
41385
41386 uint64_t  __attribute__((export_name("TS_RouteHop_clone"))) TS_RouteHop_clone(uint64_t orig) {
41387         LDKRouteHop orig_conv;
41388         orig_conv.inner = untag_ptr(orig);
41389         orig_conv.is_owned = ptr_is_owned(orig);
41390         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41391         orig_conv.is_owned = false;
41392         LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
41393         uint64_t ret_ref = 0;
41394         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41395         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41396         return ret_ref;
41397 }
41398
41399 int64_t  __attribute__((export_name("TS_RouteHop_hash"))) TS_RouteHop_hash(uint64_t o) {
41400         LDKRouteHop o_conv;
41401         o_conv.inner = untag_ptr(o);
41402         o_conv.is_owned = ptr_is_owned(o);
41403         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41404         o_conv.is_owned = false;
41405         int64_t ret_conv = RouteHop_hash(&o_conv);
41406         return ret_conv;
41407 }
41408
41409 jboolean  __attribute__((export_name("TS_RouteHop_eq"))) TS_RouteHop_eq(uint64_t a, uint64_t b) {
41410         LDKRouteHop a_conv;
41411         a_conv.inner = untag_ptr(a);
41412         a_conv.is_owned = ptr_is_owned(a);
41413         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41414         a_conv.is_owned = false;
41415         LDKRouteHop b_conv;
41416         b_conv.inner = untag_ptr(b);
41417         b_conv.is_owned = ptr_is_owned(b);
41418         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41419         b_conv.is_owned = false;
41420         jboolean ret_conv = RouteHop_eq(&a_conv, &b_conv);
41421         return ret_conv;
41422 }
41423
41424 int8_tArray  __attribute__((export_name("TS_RouteHop_write"))) TS_RouteHop_write(uint64_t obj) {
41425         LDKRouteHop obj_conv;
41426         obj_conv.inner = untag_ptr(obj);
41427         obj_conv.is_owned = ptr_is_owned(obj);
41428         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41429         obj_conv.is_owned = false;
41430         LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
41431         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
41432         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
41433         CVec_u8Z_free(ret_var);
41434         return ret_arr;
41435 }
41436
41437 uint64_t  __attribute__((export_name("TS_RouteHop_read"))) TS_RouteHop_read(int8_tArray ser) {
41438         LDKu8slice ser_ref;
41439         ser_ref.datalen = ser->arr_len;
41440         ser_ref.data = ser->elems;
41441         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
41442         *ret_conv = RouteHop_read(ser_ref);
41443         FREE(ser);
41444         return tag_ptr(ret_conv, true);
41445 }
41446
41447 void  __attribute__((export_name("TS_Route_free"))) TS_Route_free(uint64_t this_obj) {
41448         LDKRoute this_obj_conv;
41449         this_obj_conv.inner = untag_ptr(this_obj);
41450         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41452         Route_free(this_obj_conv);
41453 }
41454
41455 ptrArray  __attribute__((export_name("TS_Route_get_paths"))) TS_Route_get_paths(uint64_t this_ptr) {
41456         LDKRoute this_ptr_conv;
41457         this_ptr_conv.inner = untag_ptr(this_ptr);
41458         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41460         this_ptr_conv.is_owned = false;
41461         LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv);
41462         ptrArray ret_arr = NULL;
41463         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
41464         uint64_tArray *ret_arr_ptr = (uint64_tArray*)(((uint8_t*)ret_arr) + 8);
41465         for (size_t m = 0; m < ret_var.datalen; m++) {
41466                 LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m];
41467                 uint64_tArray ret_conv_12_arr = NULL;
41468                 ret_conv_12_arr = init_uint64_tArray(ret_conv_12_var.datalen, __LINE__);
41469                 uint64_t *ret_conv_12_arr_ptr = (uint64_t*)(((uint8_t*)ret_conv_12_arr) + 8);
41470                 for (size_t k = 0; k < ret_conv_12_var.datalen; k++) {
41471                         LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k];
41472                         uint64_t ret_conv_12_conv_10_ref = 0;
41473                         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_conv_10_var);
41474                         ret_conv_12_conv_10_ref = tag_ptr(ret_conv_12_conv_10_var.inner, ret_conv_12_conv_10_var.is_owned);
41475                         ret_conv_12_arr_ptr[k] = ret_conv_12_conv_10_ref;
41476                 }
41477                 
41478                 FREE(ret_conv_12_var.data);
41479                 ret_arr_ptr[m] = ret_conv_12_arr;
41480         }
41481         
41482         FREE(ret_var.data);
41483         return ret_arr;
41484 }
41485
41486 void  __attribute__((export_name("TS_Route_set_paths"))) TS_Route_set_paths(uint64_t this_ptr, ptrArray val) {
41487         LDKRoute this_ptr_conv;
41488         this_ptr_conv.inner = untag_ptr(this_ptr);
41489         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41490         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41491         this_ptr_conv.is_owned = false;
41492         LDKCVec_CVec_RouteHopZZ val_constr;
41493         val_constr.datalen = val->arr_len;
41494         if (val_constr.datalen > 0)
41495                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
41496         else
41497                 val_constr.data = NULL;
41498         uint64_tArray* val_vals = (void*) val->elems;
41499         for (size_t m = 0; m < val_constr.datalen; m++) {
41500                 uint64_tArray val_conv_12 = val_vals[m];
41501                 LDKCVec_RouteHopZ val_conv_12_constr;
41502                 val_conv_12_constr.datalen = val_conv_12->arr_len;
41503                 if (val_conv_12_constr.datalen > 0)
41504                         val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
41505                 else
41506                         val_conv_12_constr.data = NULL;
41507                 uint64_t* val_conv_12_vals = val_conv_12->elems;
41508                 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
41509                         uint64_t val_conv_12_conv_10 = val_conv_12_vals[k];
41510                         LDKRouteHop val_conv_12_conv_10_conv;
41511                         val_conv_12_conv_10_conv.inner = untag_ptr(val_conv_12_conv_10);
41512                         val_conv_12_conv_10_conv.is_owned = ptr_is_owned(val_conv_12_conv_10);
41513                         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv_10_conv);
41514                         val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
41515                         val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
41516                 }
41517                 FREE(val_conv_12);
41518                 val_constr.data[m] = val_conv_12_constr;
41519         }
41520         FREE(val);
41521         Route_set_paths(&this_ptr_conv, val_constr);
41522 }
41523
41524 uint64_t  __attribute__((export_name("TS_Route_get_payment_params"))) TS_Route_get_payment_params(uint64_t this_ptr) {
41525         LDKRoute this_ptr_conv;
41526         this_ptr_conv.inner = untag_ptr(this_ptr);
41527         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41529         this_ptr_conv.is_owned = false;
41530         LDKPaymentParameters ret_var = Route_get_payment_params(&this_ptr_conv);
41531         uint64_t ret_ref = 0;
41532         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41533         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41534         return ret_ref;
41535 }
41536
41537 void  __attribute__((export_name("TS_Route_set_payment_params"))) TS_Route_set_payment_params(uint64_t this_ptr, uint64_t val) {
41538         LDKRoute this_ptr_conv;
41539         this_ptr_conv.inner = untag_ptr(this_ptr);
41540         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41542         this_ptr_conv.is_owned = false;
41543         LDKPaymentParameters val_conv;
41544         val_conv.inner = untag_ptr(val);
41545         val_conv.is_owned = ptr_is_owned(val);
41546         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41547         val_conv = PaymentParameters_clone(&val_conv);
41548         Route_set_payment_params(&this_ptr_conv, val_conv);
41549 }
41550
41551 uint64_t  __attribute__((export_name("TS_Route_new"))) TS_Route_new(ptrArray paths_arg, uint64_t payment_params_arg) {
41552         LDKCVec_CVec_RouteHopZZ paths_arg_constr;
41553         paths_arg_constr.datalen = paths_arg->arr_len;
41554         if (paths_arg_constr.datalen > 0)
41555                 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
41556         else
41557                 paths_arg_constr.data = NULL;
41558         uint64_tArray* paths_arg_vals = (void*) paths_arg->elems;
41559         for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
41560                 uint64_tArray paths_arg_conv_12 = paths_arg_vals[m];
41561                 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
41562                 paths_arg_conv_12_constr.datalen = paths_arg_conv_12->arr_len;
41563                 if (paths_arg_conv_12_constr.datalen > 0)
41564                         paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
41565                 else
41566                         paths_arg_conv_12_constr.data = NULL;
41567                 uint64_t* paths_arg_conv_12_vals = paths_arg_conv_12->elems;
41568                 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
41569                         uint64_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
41570                         LDKRouteHop paths_arg_conv_12_conv_10_conv;
41571                         paths_arg_conv_12_conv_10_conv.inner = untag_ptr(paths_arg_conv_12_conv_10);
41572                         paths_arg_conv_12_conv_10_conv.is_owned = ptr_is_owned(paths_arg_conv_12_conv_10);
41573                         CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_12_conv_10_conv);
41574                         paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
41575                         paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
41576                 }
41577                 FREE(paths_arg_conv_12);
41578                 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
41579         }
41580         FREE(paths_arg);
41581         LDKPaymentParameters payment_params_arg_conv;
41582         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
41583         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
41584         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
41585         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
41586         LDKRoute ret_var = Route_new(paths_arg_constr, payment_params_arg_conv);
41587         uint64_t ret_ref = 0;
41588         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41589         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41590         return ret_ref;
41591 }
41592
41593 static inline uint64_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
41594         LDKRoute ret_var = Route_clone(arg);
41595         uint64_t ret_ref = 0;
41596         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41597         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41598         return ret_ref;
41599 }
41600 int64_t  __attribute__((export_name("TS_Route_clone_ptr"))) TS_Route_clone_ptr(uint64_t arg) {
41601         LDKRoute arg_conv;
41602         arg_conv.inner = untag_ptr(arg);
41603         arg_conv.is_owned = ptr_is_owned(arg);
41604         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41605         arg_conv.is_owned = false;
41606         int64_t ret_conv = Route_clone_ptr(&arg_conv);
41607         return ret_conv;
41608 }
41609
41610 uint64_t  __attribute__((export_name("TS_Route_clone"))) TS_Route_clone(uint64_t orig) {
41611         LDKRoute orig_conv;
41612         orig_conv.inner = untag_ptr(orig);
41613         orig_conv.is_owned = ptr_is_owned(orig);
41614         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41615         orig_conv.is_owned = false;
41616         LDKRoute ret_var = Route_clone(&orig_conv);
41617         uint64_t ret_ref = 0;
41618         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41619         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41620         return ret_ref;
41621 }
41622
41623 int64_t  __attribute__((export_name("TS_Route_hash"))) TS_Route_hash(uint64_t o) {
41624         LDKRoute o_conv;
41625         o_conv.inner = untag_ptr(o);
41626         o_conv.is_owned = ptr_is_owned(o);
41627         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41628         o_conv.is_owned = false;
41629         int64_t ret_conv = Route_hash(&o_conv);
41630         return ret_conv;
41631 }
41632
41633 jboolean  __attribute__((export_name("TS_Route_eq"))) TS_Route_eq(uint64_t a, uint64_t b) {
41634         LDKRoute a_conv;
41635         a_conv.inner = untag_ptr(a);
41636         a_conv.is_owned = ptr_is_owned(a);
41637         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41638         a_conv.is_owned = false;
41639         LDKRoute b_conv;
41640         b_conv.inner = untag_ptr(b);
41641         b_conv.is_owned = ptr_is_owned(b);
41642         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41643         b_conv.is_owned = false;
41644         jboolean ret_conv = Route_eq(&a_conv, &b_conv);
41645         return ret_conv;
41646 }
41647
41648 int64_t  __attribute__((export_name("TS_Route_get_total_fees"))) TS_Route_get_total_fees(uint64_t this_arg) {
41649         LDKRoute this_arg_conv;
41650         this_arg_conv.inner = untag_ptr(this_arg);
41651         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41653         this_arg_conv.is_owned = false;
41654         int64_t ret_conv = Route_get_total_fees(&this_arg_conv);
41655         return ret_conv;
41656 }
41657
41658 int64_t  __attribute__((export_name("TS_Route_get_total_amount"))) TS_Route_get_total_amount(uint64_t this_arg) {
41659         LDKRoute this_arg_conv;
41660         this_arg_conv.inner = untag_ptr(this_arg);
41661         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41663         this_arg_conv.is_owned = false;
41664         int64_t ret_conv = Route_get_total_amount(&this_arg_conv);
41665         return ret_conv;
41666 }
41667
41668 int8_tArray  __attribute__((export_name("TS_Route_write"))) TS_Route_write(uint64_t obj) {
41669         LDKRoute obj_conv;
41670         obj_conv.inner = untag_ptr(obj);
41671         obj_conv.is_owned = ptr_is_owned(obj);
41672         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41673         obj_conv.is_owned = false;
41674         LDKCVec_u8Z ret_var = Route_write(&obj_conv);
41675         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
41676         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
41677         CVec_u8Z_free(ret_var);
41678         return ret_arr;
41679 }
41680
41681 uint64_t  __attribute__((export_name("TS_Route_read"))) TS_Route_read(int8_tArray ser) {
41682         LDKu8slice ser_ref;
41683         ser_ref.datalen = ser->arr_len;
41684         ser_ref.data = ser->elems;
41685         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
41686         *ret_conv = Route_read(ser_ref);
41687         FREE(ser);
41688         return tag_ptr(ret_conv, true);
41689 }
41690
41691 void  __attribute__((export_name("TS_RouteParameters_free"))) TS_RouteParameters_free(uint64_t this_obj) {
41692         LDKRouteParameters this_obj_conv;
41693         this_obj_conv.inner = untag_ptr(this_obj);
41694         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41696         RouteParameters_free(this_obj_conv);
41697 }
41698
41699 uint64_t  __attribute__((export_name("TS_RouteParameters_get_payment_params"))) TS_RouteParameters_get_payment_params(uint64_t this_ptr) {
41700         LDKRouteParameters this_ptr_conv;
41701         this_ptr_conv.inner = untag_ptr(this_ptr);
41702         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41704         this_ptr_conv.is_owned = false;
41705         LDKPaymentParameters ret_var = RouteParameters_get_payment_params(&this_ptr_conv);
41706         uint64_t ret_ref = 0;
41707         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41708         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41709         return ret_ref;
41710 }
41711
41712 void  __attribute__((export_name("TS_RouteParameters_set_payment_params"))) TS_RouteParameters_set_payment_params(uint64_t this_ptr, uint64_t val) {
41713         LDKRouteParameters this_ptr_conv;
41714         this_ptr_conv.inner = untag_ptr(this_ptr);
41715         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41717         this_ptr_conv.is_owned = false;
41718         LDKPaymentParameters val_conv;
41719         val_conv.inner = untag_ptr(val);
41720         val_conv.is_owned = ptr_is_owned(val);
41721         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41722         val_conv = PaymentParameters_clone(&val_conv);
41723         RouteParameters_set_payment_params(&this_ptr_conv, val_conv);
41724 }
41725
41726 int64_t  __attribute__((export_name("TS_RouteParameters_get_final_value_msat"))) TS_RouteParameters_get_final_value_msat(uint64_t this_ptr) {
41727         LDKRouteParameters this_ptr_conv;
41728         this_ptr_conv.inner = untag_ptr(this_ptr);
41729         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41731         this_ptr_conv.is_owned = false;
41732         int64_t ret_conv = RouteParameters_get_final_value_msat(&this_ptr_conv);
41733         return ret_conv;
41734 }
41735
41736 void  __attribute__((export_name("TS_RouteParameters_set_final_value_msat"))) TS_RouteParameters_set_final_value_msat(uint64_t this_ptr, int64_t val) {
41737         LDKRouteParameters this_ptr_conv;
41738         this_ptr_conv.inner = untag_ptr(this_ptr);
41739         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41741         this_ptr_conv.is_owned = false;
41742         RouteParameters_set_final_value_msat(&this_ptr_conv, val);
41743 }
41744
41745 int32_t  __attribute__((export_name("TS_RouteParameters_get_final_cltv_expiry_delta"))) TS_RouteParameters_get_final_cltv_expiry_delta(uint64_t this_ptr) {
41746         LDKRouteParameters this_ptr_conv;
41747         this_ptr_conv.inner = untag_ptr(this_ptr);
41748         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41750         this_ptr_conv.is_owned = false;
41751         int32_t ret_conv = RouteParameters_get_final_cltv_expiry_delta(&this_ptr_conv);
41752         return ret_conv;
41753 }
41754
41755 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) {
41756         LDKRouteParameters this_ptr_conv;
41757         this_ptr_conv.inner = untag_ptr(this_ptr);
41758         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41760         this_ptr_conv.is_owned = false;
41761         RouteParameters_set_final_cltv_expiry_delta(&this_ptr_conv, val);
41762 }
41763
41764 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) {
41765         LDKPaymentParameters payment_params_arg_conv;
41766         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
41767         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
41768         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
41769         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
41770         LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg, final_cltv_expiry_delta_arg);
41771         uint64_t ret_ref = 0;
41772         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41773         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41774         return ret_ref;
41775 }
41776
41777 static inline uint64_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
41778         LDKRouteParameters ret_var = RouteParameters_clone(arg);
41779         uint64_t ret_ref = 0;
41780         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41781         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41782         return ret_ref;
41783 }
41784 int64_t  __attribute__((export_name("TS_RouteParameters_clone_ptr"))) TS_RouteParameters_clone_ptr(uint64_t arg) {
41785         LDKRouteParameters arg_conv;
41786         arg_conv.inner = untag_ptr(arg);
41787         arg_conv.is_owned = ptr_is_owned(arg);
41788         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41789         arg_conv.is_owned = false;
41790         int64_t ret_conv = RouteParameters_clone_ptr(&arg_conv);
41791         return ret_conv;
41792 }
41793
41794 uint64_t  __attribute__((export_name("TS_RouteParameters_clone"))) TS_RouteParameters_clone(uint64_t orig) {
41795         LDKRouteParameters orig_conv;
41796         orig_conv.inner = untag_ptr(orig);
41797         orig_conv.is_owned = ptr_is_owned(orig);
41798         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41799         orig_conv.is_owned = false;
41800         LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
41801         uint64_t ret_ref = 0;
41802         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41803         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41804         return ret_ref;
41805 }
41806
41807 int8_tArray  __attribute__((export_name("TS_RouteParameters_write"))) TS_RouteParameters_write(uint64_t obj) {
41808         LDKRouteParameters obj_conv;
41809         obj_conv.inner = untag_ptr(obj);
41810         obj_conv.is_owned = ptr_is_owned(obj);
41811         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41812         obj_conv.is_owned = false;
41813         LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
41814         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
41815         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
41816         CVec_u8Z_free(ret_var);
41817         return ret_arr;
41818 }
41819
41820 uint64_t  __attribute__((export_name("TS_RouteParameters_read"))) TS_RouteParameters_read(int8_tArray ser) {
41821         LDKu8slice ser_ref;
41822         ser_ref.datalen = ser->arr_len;
41823         ser_ref.data = ser->elems;
41824         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
41825         *ret_conv = RouteParameters_read(ser_ref);
41826         FREE(ser);
41827         return tag_ptr(ret_conv, true);
41828 }
41829
41830 void  __attribute__((export_name("TS_PaymentParameters_free"))) TS_PaymentParameters_free(uint64_t this_obj) {
41831         LDKPaymentParameters this_obj_conv;
41832         this_obj_conv.inner = untag_ptr(this_obj);
41833         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41835         PaymentParameters_free(this_obj_conv);
41836 }
41837
41838 int8_tArray  __attribute__((export_name("TS_PaymentParameters_get_payee_pubkey"))) TS_PaymentParameters_get_payee_pubkey(uint64_t this_ptr) {
41839         LDKPaymentParameters this_ptr_conv;
41840         this_ptr_conv.inner = untag_ptr(this_ptr);
41841         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41843         this_ptr_conv.is_owned = false;
41844         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
41845         memcpy(ret_arr->elems, PaymentParameters_get_payee_pubkey(&this_ptr_conv).compressed_form, 33);
41846         return ret_arr;
41847 }
41848
41849 void  __attribute__((export_name("TS_PaymentParameters_set_payee_pubkey"))) TS_PaymentParameters_set_payee_pubkey(uint64_t this_ptr, int8_tArray val) {
41850         LDKPaymentParameters this_ptr_conv;
41851         this_ptr_conv.inner = untag_ptr(this_ptr);
41852         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41854         this_ptr_conv.is_owned = false;
41855         LDKPublicKey val_ref;
41856         CHECK(val->arr_len == 33);
41857         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
41858         PaymentParameters_set_payee_pubkey(&this_ptr_conv, val_ref);
41859 }
41860
41861 uint64_t  __attribute__((export_name("TS_PaymentParameters_get_features"))) TS_PaymentParameters_get_features(uint64_t this_ptr) {
41862         LDKPaymentParameters this_ptr_conv;
41863         this_ptr_conv.inner = untag_ptr(this_ptr);
41864         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41866         this_ptr_conv.is_owned = false;
41867         LDKInvoiceFeatures ret_var = PaymentParameters_get_features(&this_ptr_conv);
41868         uint64_t ret_ref = 0;
41869         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41870         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41871         return ret_ref;
41872 }
41873
41874 void  __attribute__((export_name("TS_PaymentParameters_set_features"))) TS_PaymentParameters_set_features(uint64_t this_ptr, uint64_t val) {
41875         LDKPaymentParameters this_ptr_conv;
41876         this_ptr_conv.inner = untag_ptr(this_ptr);
41877         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41879         this_ptr_conv.is_owned = false;
41880         LDKInvoiceFeatures val_conv;
41881         val_conv.inner = untag_ptr(val);
41882         val_conv.is_owned = ptr_is_owned(val);
41883         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41884         val_conv = InvoiceFeatures_clone(&val_conv);
41885         PaymentParameters_set_features(&this_ptr_conv, val_conv);
41886 }
41887
41888 uint64_tArray  __attribute__((export_name("TS_PaymentParameters_get_route_hints"))) TS_PaymentParameters_get_route_hints(uint64_t this_ptr) {
41889         LDKPaymentParameters this_ptr_conv;
41890         this_ptr_conv.inner = untag_ptr(this_ptr);
41891         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41893         this_ptr_conv.is_owned = false;
41894         LDKCVec_RouteHintZ ret_var = PaymentParameters_get_route_hints(&this_ptr_conv);
41895         uint64_tArray ret_arr = NULL;
41896         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
41897         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
41898         for (size_t l = 0; l < ret_var.datalen; l++) {
41899                 LDKRouteHint ret_conv_11_var = ret_var.data[l];
41900                 uint64_t ret_conv_11_ref = 0;
41901                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
41902                 ret_conv_11_ref = tag_ptr(ret_conv_11_var.inner, ret_conv_11_var.is_owned);
41903                 ret_arr_ptr[l] = ret_conv_11_ref;
41904         }
41905         
41906         FREE(ret_var.data);
41907         return ret_arr;
41908 }
41909
41910 void  __attribute__((export_name("TS_PaymentParameters_set_route_hints"))) TS_PaymentParameters_set_route_hints(uint64_t this_ptr, uint64_tArray val) {
41911         LDKPaymentParameters this_ptr_conv;
41912         this_ptr_conv.inner = untag_ptr(this_ptr);
41913         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41915         this_ptr_conv.is_owned = false;
41916         LDKCVec_RouteHintZ val_constr;
41917         val_constr.datalen = val->arr_len;
41918         if (val_constr.datalen > 0)
41919                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
41920         else
41921                 val_constr.data = NULL;
41922         uint64_t* val_vals = val->elems;
41923         for (size_t l = 0; l < val_constr.datalen; l++) {
41924                 uint64_t val_conv_11 = val_vals[l];
41925                 LDKRouteHint val_conv_11_conv;
41926                 val_conv_11_conv.inner = untag_ptr(val_conv_11);
41927                 val_conv_11_conv.is_owned = ptr_is_owned(val_conv_11);
41928                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_11_conv);
41929                 val_conv_11_conv = RouteHint_clone(&val_conv_11_conv);
41930                 val_constr.data[l] = val_conv_11_conv;
41931         }
41932         FREE(val);
41933         PaymentParameters_set_route_hints(&this_ptr_conv, val_constr);
41934 }
41935
41936 uint64_t  __attribute__((export_name("TS_PaymentParameters_get_expiry_time"))) TS_PaymentParameters_get_expiry_time(uint64_t this_ptr) {
41937         LDKPaymentParameters this_ptr_conv;
41938         this_ptr_conv.inner = untag_ptr(this_ptr);
41939         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41941         this_ptr_conv.is_owned = false;
41942         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
41943         *ret_copy = PaymentParameters_get_expiry_time(&this_ptr_conv);
41944         uint64_t ret_ref = tag_ptr(ret_copy, true);
41945         return ret_ref;
41946 }
41947
41948 void  __attribute__((export_name("TS_PaymentParameters_set_expiry_time"))) TS_PaymentParameters_set_expiry_time(uint64_t this_ptr, uint64_t val) {
41949         LDKPaymentParameters this_ptr_conv;
41950         this_ptr_conv.inner = untag_ptr(this_ptr);
41951         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41953         this_ptr_conv.is_owned = false;
41954         void* val_ptr = untag_ptr(val);
41955         CHECK_ACCESS(val_ptr);
41956         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
41957         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
41958         PaymentParameters_set_expiry_time(&this_ptr_conv, val_conv);
41959 }
41960
41961 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) {
41962         LDKPaymentParameters this_ptr_conv;
41963         this_ptr_conv.inner = untag_ptr(this_ptr);
41964         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41966         this_ptr_conv.is_owned = false;
41967         int32_t ret_conv = PaymentParameters_get_max_total_cltv_expiry_delta(&this_ptr_conv);
41968         return ret_conv;
41969 }
41970
41971 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) {
41972         LDKPaymentParameters this_ptr_conv;
41973         this_ptr_conv.inner = untag_ptr(this_ptr);
41974         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41976         this_ptr_conv.is_owned = false;
41977         PaymentParameters_set_max_total_cltv_expiry_delta(&this_ptr_conv, val);
41978 }
41979
41980 int8_t  __attribute__((export_name("TS_PaymentParameters_get_max_path_count"))) TS_PaymentParameters_get_max_path_count(uint64_t this_ptr) {
41981         LDKPaymentParameters this_ptr_conv;
41982         this_ptr_conv.inner = untag_ptr(this_ptr);
41983         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41985         this_ptr_conv.is_owned = false;
41986         int8_t ret_conv = PaymentParameters_get_max_path_count(&this_ptr_conv);
41987         return ret_conv;
41988 }
41989
41990 void  __attribute__((export_name("TS_PaymentParameters_set_max_path_count"))) TS_PaymentParameters_set_max_path_count(uint64_t this_ptr, int8_t val) {
41991         LDKPaymentParameters this_ptr_conv;
41992         this_ptr_conv.inner = untag_ptr(this_ptr);
41993         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41995         this_ptr_conv.is_owned = false;
41996         PaymentParameters_set_max_path_count(&this_ptr_conv, val);
41997 }
41998
41999 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) {
42000         LDKPaymentParameters this_ptr_conv;
42001         this_ptr_conv.inner = untag_ptr(this_ptr);
42002         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42004         this_ptr_conv.is_owned = false;
42005         int8_t ret_conv = PaymentParameters_get_max_channel_saturation_power_of_half(&this_ptr_conv);
42006         return ret_conv;
42007 }
42008
42009 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) {
42010         LDKPaymentParameters this_ptr_conv;
42011         this_ptr_conv.inner = untag_ptr(this_ptr);
42012         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42014         this_ptr_conv.is_owned = false;
42015         PaymentParameters_set_max_channel_saturation_power_of_half(&this_ptr_conv, val);
42016 }
42017
42018 int64_tArray  __attribute__((export_name("TS_PaymentParameters_get_previously_failed_channels"))) TS_PaymentParameters_get_previously_failed_channels(uint64_t this_ptr) {
42019         LDKPaymentParameters this_ptr_conv;
42020         this_ptr_conv.inner = untag_ptr(this_ptr);
42021         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42023         this_ptr_conv.is_owned = false;
42024         LDKCVec_u64Z ret_var = PaymentParameters_get_previously_failed_channels(&this_ptr_conv);
42025         int64_tArray ret_arr = NULL;
42026         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
42027         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
42028         for (size_t i = 0; i < ret_var.datalen; i++) {
42029                 int64_t ret_conv_8_conv = ret_var.data[i];
42030                 ret_arr_ptr[i] = ret_conv_8_conv;
42031         }
42032         
42033         FREE(ret_var.data);
42034         return ret_arr;
42035 }
42036
42037 void  __attribute__((export_name("TS_PaymentParameters_set_previously_failed_channels"))) TS_PaymentParameters_set_previously_failed_channels(uint64_t this_ptr, int64_tArray val) {
42038         LDKPaymentParameters this_ptr_conv;
42039         this_ptr_conv.inner = untag_ptr(this_ptr);
42040         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42042         this_ptr_conv.is_owned = false;
42043         LDKCVec_u64Z val_constr;
42044         val_constr.datalen = val->arr_len;
42045         if (val_constr.datalen > 0)
42046                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
42047         else
42048                 val_constr.data = NULL;
42049         int64_t* val_vals = val->elems;
42050         for (size_t i = 0; i < val_constr.datalen; i++) {
42051                 int64_t val_conv_8 = val_vals[i];
42052                 val_constr.data[i] = val_conv_8;
42053         }
42054         FREE(val);
42055         PaymentParameters_set_previously_failed_channels(&this_ptr_conv, val_constr);
42056 }
42057
42058 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) {
42059         LDKPublicKey payee_pubkey_arg_ref;
42060         CHECK(payee_pubkey_arg->arr_len == 33);
42061         memcpy(payee_pubkey_arg_ref.compressed_form, payee_pubkey_arg->elems, 33); FREE(payee_pubkey_arg);
42062         LDKInvoiceFeatures features_arg_conv;
42063         features_arg_conv.inner = untag_ptr(features_arg);
42064         features_arg_conv.is_owned = ptr_is_owned(features_arg);
42065         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
42066         features_arg_conv = InvoiceFeatures_clone(&features_arg_conv);
42067         LDKCVec_RouteHintZ route_hints_arg_constr;
42068         route_hints_arg_constr.datalen = route_hints_arg->arr_len;
42069         if (route_hints_arg_constr.datalen > 0)
42070                 route_hints_arg_constr.data = MALLOC(route_hints_arg_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
42071         else
42072                 route_hints_arg_constr.data = NULL;
42073         uint64_t* route_hints_arg_vals = route_hints_arg->elems;
42074         for (size_t l = 0; l < route_hints_arg_constr.datalen; l++) {
42075                 uint64_t route_hints_arg_conv_11 = route_hints_arg_vals[l];
42076                 LDKRouteHint route_hints_arg_conv_11_conv;
42077                 route_hints_arg_conv_11_conv.inner = untag_ptr(route_hints_arg_conv_11);
42078                 route_hints_arg_conv_11_conv.is_owned = ptr_is_owned(route_hints_arg_conv_11);
42079                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_arg_conv_11_conv);
42080                 route_hints_arg_conv_11_conv = RouteHint_clone(&route_hints_arg_conv_11_conv);
42081                 route_hints_arg_constr.data[l] = route_hints_arg_conv_11_conv;
42082         }
42083         FREE(route_hints_arg);
42084         void* expiry_time_arg_ptr = untag_ptr(expiry_time_arg);
42085         CHECK_ACCESS(expiry_time_arg_ptr);
42086         LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
42087         expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(expiry_time_arg));
42088         LDKCVec_u64Z previously_failed_channels_arg_constr;
42089         previously_failed_channels_arg_constr.datalen = previously_failed_channels_arg->arr_len;
42090         if (previously_failed_channels_arg_constr.datalen > 0)
42091                 previously_failed_channels_arg_constr.data = MALLOC(previously_failed_channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
42092         else
42093                 previously_failed_channels_arg_constr.data = NULL;
42094         int64_t* previously_failed_channels_arg_vals = previously_failed_channels_arg->elems;
42095         for (size_t i = 0; i < previously_failed_channels_arg_constr.datalen; i++) {
42096                 int64_t previously_failed_channels_arg_conv_8 = previously_failed_channels_arg_vals[i];
42097                 previously_failed_channels_arg_constr.data[i] = previously_failed_channels_arg_conv_8;
42098         }
42099         FREE(previously_failed_channels_arg);
42100         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);
42101         uint64_t ret_ref = 0;
42102         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42103         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42104         return ret_ref;
42105 }
42106
42107 static inline uint64_t PaymentParameters_clone_ptr(LDKPaymentParameters *NONNULL_PTR arg) {
42108         LDKPaymentParameters ret_var = PaymentParameters_clone(arg);
42109         uint64_t ret_ref = 0;
42110         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42111         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42112         return ret_ref;
42113 }
42114 int64_t  __attribute__((export_name("TS_PaymentParameters_clone_ptr"))) TS_PaymentParameters_clone_ptr(uint64_t arg) {
42115         LDKPaymentParameters arg_conv;
42116         arg_conv.inner = untag_ptr(arg);
42117         arg_conv.is_owned = ptr_is_owned(arg);
42118         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42119         arg_conv.is_owned = false;
42120         int64_t ret_conv = PaymentParameters_clone_ptr(&arg_conv);
42121         return ret_conv;
42122 }
42123
42124 uint64_t  __attribute__((export_name("TS_PaymentParameters_clone"))) TS_PaymentParameters_clone(uint64_t orig) {
42125         LDKPaymentParameters orig_conv;
42126         orig_conv.inner = untag_ptr(orig);
42127         orig_conv.is_owned = ptr_is_owned(orig);
42128         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42129         orig_conv.is_owned = false;
42130         LDKPaymentParameters ret_var = PaymentParameters_clone(&orig_conv);
42131         uint64_t ret_ref = 0;
42132         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42133         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42134         return ret_ref;
42135 }
42136
42137 int64_t  __attribute__((export_name("TS_PaymentParameters_hash"))) TS_PaymentParameters_hash(uint64_t o) {
42138         LDKPaymentParameters o_conv;
42139         o_conv.inner = untag_ptr(o);
42140         o_conv.is_owned = ptr_is_owned(o);
42141         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42142         o_conv.is_owned = false;
42143         int64_t ret_conv = PaymentParameters_hash(&o_conv);
42144         return ret_conv;
42145 }
42146
42147 jboolean  __attribute__((export_name("TS_PaymentParameters_eq"))) TS_PaymentParameters_eq(uint64_t a, uint64_t b) {
42148         LDKPaymentParameters a_conv;
42149         a_conv.inner = untag_ptr(a);
42150         a_conv.is_owned = ptr_is_owned(a);
42151         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42152         a_conv.is_owned = false;
42153         LDKPaymentParameters b_conv;
42154         b_conv.inner = untag_ptr(b);
42155         b_conv.is_owned = ptr_is_owned(b);
42156         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42157         b_conv.is_owned = false;
42158         jboolean ret_conv = PaymentParameters_eq(&a_conv, &b_conv);
42159         return ret_conv;
42160 }
42161
42162 int8_tArray  __attribute__((export_name("TS_PaymentParameters_write"))) TS_PaymentParameters_write(uint64_t obj) {
42163         LDKPaymentParameters obj_conv;
42164         obj_conv.inner = untag_ptr(obj);
42165         obj_conv.is_owned = ptr_is_owned(obj);
42166         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42167         obj_conv.is_owned = false;
42168         LDKCVec_u8Z ret_var = PaymentParameters_write(&obj_conv);
42169         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42170         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42171         CVec_u8Z_free(ret_var);
42172         return ret_arr;
42173 }
42174
42175 uint64_t  __attribute__((export_name("TS_PaymentParameters_read"))) TS_PaymentParameters_read(int8_tArray ser) {
42176         LDKu8slice ser_ref;
42177         ser_ref.datalen = ser->arr_len;
42178         ser_ref.data = ser->elems;
42179         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
42180         *ret_conv = PaymentParameters_read(ser_ref);
42181         FREE(ser);
42182         return tag_ptr(ret_conv, true);
42183 }
42184
42185 uint64_t  __attribute__((export_name("TS_PaymentParameters_from_node_id"))) TS_PaymentParameters_from_node_id(int8_tArray payee_pubkey) {
42186         LDKPublicKey payee_pubkey_ref;
42187         CHECK(payee_pubkey->arr_len == 33);
42188         memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
42189         LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref);
42190         uint64_t ret_ref = 0;
42191         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42192         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42193         return ret_ref;
42194 }
42195
42196 uint64_t  __attribute__((export_name("TS_PaymentParameters_for_keysend"))) TS_PaymentParameters_for_keysend(int8_tArray payee_pubkey) {
42197         LDKPublicKey payee_pubkey_ref;
42198         CHECK(payee_pubkey->arr_len == 33);
42199         memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
42200         LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref);
42201         uint64_t ret_ref = 0;
42202         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42203         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42204         return ret_ref;
42205 }
42206
42207 void  __attribute__((export_name("TS_RouteHint_free"))) TS_RouteHint_free(uint64_t this_obj) {
42208         LDKRouteHint this_obj_conv;
42209         this_obj_conv.inner = untag_ptr(this_obj);
42210         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42212         RouteHint_free(this_obj_conv);
42213 }
42214
42215 uint64_tArray  __attribute__((export_name("TS_RouteHint_get_a"))) TS_RouteHint_get_a(uint64_t this_ptr) {
42216         LDKRouteHint this_ptr_conv;
42217         this_ptr_conv.inner = untag_ptr(this_ptr);
42218         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42220         this_ptr_conv.is_owned = false;
42221         LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
42222         uint64_tArray ret_arr = NULL;
42223         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
42224         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
42225         for (size_t o = 0; o < ret_var.datalen; o++) {
42226                 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
42227                 uint64_t ret_conv_14_ref = 0;
42228                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
42229                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
42230                 ret_arr_ptr[o] = ret_conv_14_ref;
42231         }
42232         
42233         FREE(ret_var.data);
42234         return ret_arr;
42235 }
42236
42237 void  __attribute__((export_name("TS_RouteHint_set_a"))) TS_RouteHint_set_a(uint64_t this_ptr, uint64_tArray val) {
42238         LDKRouteHint this_ptr_conv;
42239         this_ptr_conv.inner = untag_ptr(this_ptr);
42240         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42242         this_ptr_conv.is_owned = false;
42243         LDKCVec_RouteHintHopZ val_constr;
42244         val_constr.datalen = val->arr_len;
42245         if (val_constr.datalen > 0)
42246                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
42247         else
42248                 val_constr.data = NULL;
42249         uint64_t* val_vals = val->elems;
42250         for (size_t o = 0; o < val_constr.datalen; o++) {
42251                 uint64_t val_conv_14 = val_vals[o];
42252                 LDKRouteHintHop val_conv_14_conv;
42253                 val_conv_14_conv.inner = untag_ptr(val_conv_14);
42254                 val_conv_14_conv.is_owned = ptr_is_owned(val_conv_14);
42255                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
42256                 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
42257                 val_constr.data[o] = val_conv_14_conv;
42258         }
42259         FREE(val);
42260         RouteHint_set_a(&this_ptr_conv, val_constr);
42261 }
42262
42263 uint64_t  __attribute__((export_name("TS_RouteHint_new"))) TS_RouteHint_new(uint64_tArray a_arg) {
42264         LDKCVec_RouteHintHopZ a_arg_constr;
42265         a_arg_constr.datalen = a_arg->arr_len;
42266         if (a_arg_constr.datalen > 0)
42267                 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
42268         else
42269                 a_arg_constr.data = NULL;
42270         uint64_t* a_arg_vals = a_arg->elems;
42271         for (size_t o = 0; o < a_arg_constr.datalen; o++) {
42272                 uint64_t a_arg_conv_14 = a_arg_vals[o];
42273                 LDKRouteHintHop a_arg_conv_14_conv;
42274                 a_arg_conv_14_conv.inner = untag_ptr(a_arg_conv_14);
42275                 a_arg_conv_14_conv.is_owned = ptr_is_owned(a_arg_conv_14);
42276                 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
42277                 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
42278                 a_arg_constr.data[o] = a_arg_conv_14_conv;
42279         }
42280         FREE(a_arg);
42281         LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
42282         uint64_t ret_ref = 0;
42283         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42284         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42285         return ret_ref;
42286 }
42287
42288 static inline uint64_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
42289         LDKRouteHint ret_var = RouteHint_clone(arg);
42290         uint64_t ret_ref = 0;
42291         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42292         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42293         return ret_ref;
42294 }
42295 int64_t  __attribute__((export_name("TS_RouteHint_clone_ptr"))) TS_RouteHint_clone_ptr(uint64_t arg) {
42296         LDKRouteHint arg_conv;
42297         arg_conv.inner = untag_ptr(arg);
42298         arg_conv.is_owned = ptr_is_owned(arg);
42299         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42300         arg_conv.is_owned = false;
42301         int64_t ret_conv = RouteHint_clone_ptr(&arg_conv);
42302         return ret_conv;
42303 }
42304
42305 uint64_t  __attribute__((export_name("TS_RouteHint_clone"))) TS_RouteHint_clone(uint64_t orig) {
42306         LDKRouteHint orig_conv;
42307         orig_conv.inner = untag_ptr(orig);
42308         orig_conv.is_owned = ptr_is_owned(orig);
42309         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42310         orig_conv.is_owned = false;
42311         LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
42312         uint64_t ret_ref = 0;
42313         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42314         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42315         return ret_ref;
42316 }
42317
42318 int64_t  __attribute__((export_name("TS_RouteHint_hash"))) TS_RouteHint_hash(uint64_t o) {
42319         LDKRouteHint o_conv;
42320         o_conv.inner = untag_ptr(o);
42321         o_conv.is_owned = ptr_is_owned(o);
42322         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42323         o_conv.is_owned = false;
42324         int64_t ret_conv = RouteHint_hash(&o_conv);
42325         return ret_conv;
42326 }
42327
42328 jboolean  __attribute__((export_name("TS_RouteHint_eq"))) TS_RouteHint_eq(uint64_t a, uint64_t b) {
42329         LDKRouteHint a_conv;
42330         a_conv.inner = untag_ptr(a);
42331         a_conv.is_owned = ptr_is_owned(a);
42332         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42333         a_conv.is_owned = false;
42334         LDKRouteHint b_conv;
42335         b_conv.inner = untag_ptr(b);
42336         b_conv.is_owned = ptr_is_owned(b);
42337         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42338         b_conv.is_owned = false;
42339         jboolean ret_conv = RouteHint_eq(&a_conv, &b_conv);
42340         return ret_conv;
42341 }
42342
42343 int8_tArray  __attribute__((export_name("TS_RouteHint_write"))) TS_RouteHint_write(uint64_t obj) {
42344         LDKRouteHint obj_conv;
42345         obj_conv.inner = untag_ptr(obj);
42346         obj_conv.is_owned = ptr_is_owned(obj);
42347         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42348         obj_conv.is_owned = false;
42349         LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
42350         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42351         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42352         CVec_u8Z_free(ret_var);
42353         return ret_arr;
42354 }
42355
42356 uint64_t  __attribute__((export_name("TS_RouteHint_read"))) TS_RouteHint_read(int8_tArray ser) {
42357         LDKu8slice ser_ref;
42358         ser_ref.datalen = ser->arr_len;
42359         ser_ref.data = ser->elems;
42360         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
42361         *ret_conv = RouteHint_read(ser_ref);
42362         FREE(ser);
42363         return tag_ptr(ret_conv, true);
42364 }
42365
42366 void  __attribute__((export_name("TS_RouteHintHop_free"))) TS_RouteHintHop_free(uint64_t this_obj) {
42367         LDKRouteHintHop this_obj_conv;
42368         this_obj_conv.inner = untag_ptr(this_obj);
42369         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42371         RouteHintHop_free(this_obj_conv);
42372 }
42373
42374 int8_tArray  __attribute__((export_name("TS_RouteHintHop_get_src_node_id"))) TS_RouteHintHop_get_src_node_id(uint64_t this_ptr) {
42375         LDKRouteHintHop this_ptr_conv;
42376         this_ptr_conv.inner = untag_ptr(this_ptr);
42377         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42379         this_ptr_conv.is_owned = false;
42380         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42381         memcpy(ret_arr->elems, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form, 33);
42382         return ret_arr;
42383 }
42384
42385 void  __attribute__((export_name("TS_RouteHintHop_set_src_node_id"))) TS_RouteHintHop_set_src_node_id(uint64_t this_ptr, int8_tArray val) {
42386         LDKRouteHintHop this_ptr_conv;
42387         this_ptr_conv.inner = untag_ptr(this_ptr);
42388         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42390         this_ptr_conv.is_owned = false;
42391         LDKPublicKey val_ref;
42392         CHECK(val->arr_len == 33);
42393         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42394         RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
42395 }
42396
42397 int64_t  __attribute__((export_name("TS_RouteHintHop_get_short_channel_id"))) TS_RouteHintHop_get_short_channel_id(uint64_t this_ptr) {
42398         LDKRouteHintHop this_ptr_conv;
42399         this_ptr_conv.inner = untag_ptr(this_ptr);
42400         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42402         this_ptr_conv.is_owned = false;
42403         int64_t ret_conv = RouteHintHop_get_short_channel_id(&this_ptr_conv);
42404         return ret_conv;
42405 }
42406
42407 void  __attribute__((export_name("TS_RouteHintHop_set_short_channel_id"))) TS_RouteHintHop_set_short_channel_id(uint64_t this_ptr, int64_t val) {
42408         LDKRouteHintHop this_ptr_conv;
42409         this_ptr_conv.inner = untag_ptr(this_ptr);
42410         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42412         this_ptr_conv.is_owned = false;
42413         RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
42414 }
42415
42416 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_fees"))) TS_RouteHintHop_get_fees(uint64_t this_ptr) {
42417         LDKRouteHintHop this_ptr_conv;
42418         this_ptr_conv.inner = untag_ptr(this_ptr);
42419         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42421         this_ptr_conv.is_owned = false;
42422         LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
42423         uint64_t ret_ref = 0;
42424         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42425         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42426         return ret_ref;
42427 }
42428
42429 void  __attribute__((export_name("TS_RouteHintHop_set_fees"))) TS_RouteHintHop_set_fees(uint64_t this_ptr, uint64_t val) {
42430         LDKRouteHintHop this_ptr_conv;
42431         this_ptr_conv.inner = untag_ptr(this_ptr);
42432         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42434         this_ptr_conv.is_owned = false;
42435         LDKRoutingFees val_conv;
42436         val_conv.inner = untag_ptr(val);
42437         val_conv.is_owned = ptr_is_owned(val);
42438         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42439         val_conv = RoutingFees_clone(&val_conv);
42440         RouteHintHop_set_fees(&this_ptr_conv, val_conv);
42441 }
42442
42443 int16_t  __attribute__((export_name("TS_RouteHintHop_get_cltv_expiry_delta"))) TS_RouteHintHop_get_cltv_expiry_delta(uint64_t this_ptr) {
42444         LDKRouteHintHop this_ptr_conv;
42445         this_ptr_conv.inner = untag_ptr(this_ptr);
42446         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42448         this_ptr_conv.is_owned = false;
42449         int16_t ret_conv = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
42450         return ret_conv;
42451 }
42452
42453 void  __attribute__((export_name("TS_RouteHintHop_set_cltv_expiry_delta"))) TS_RouteHintHop_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
42454         LDKRouteHintHop this_ptr_conv;
42455         this_ptr_conv.inner = untag_ptr(this_ptr);
42456         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42458         this_ptr_conv.is_owned = false;
42459         RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
42460 }
42461
42462 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_htlc_minimum_msat"))) TS_RouteHintHop_get_htlc_minimum_msat(uint64_t this_ptr) {
42463         LDKRouteHintHop this_ptr_conv;
42464         this_ptr_conv.inner = untag_ptr(this_ptr);
42465         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42467         this_ptr_conv.is_owned = false;
42468         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
42469         *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
42470         uint64_t ret_ref = tag_ptr(ret_copy, true);
42471         return ret_ref;
42472 }
42473
42474 void  __attribute__((export_name("TS_RouteHintHop_set_htlc_minimum_msat"))) TS_RouteHintHop_set_htlc_minimum_msat(uint64_t this_ptr, uint64_t val) {
42475         LDKRouteHintHop this_ptr_conv;
42476         this_ptr_conv.inner = untag_ptr(this_ptr);
42477         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42478         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42479         this_ptr_conv.is_owned = false;
42480         void* val_ptr = untag_ptr(val);
42481         CHECK_ACCESS(val_ptr);
42482         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
42483         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
42484         RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
42485 }
42486
42487 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_htlc_maximum_msat"))) TS_RouteHintHop_get_htlc_maximum_msat(uint64_t this_ptr) {
42488         LDKRouteHintHop this_ptr_conv;
42489         this_ptr_conv.inner = untag_ptr(this_ptr);
42490         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42492         this_ptr_conv.is_owned = false;
42493         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
42494         *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
42495         uint64_t ret_ref = tag_ptr(ret_copy, true);
42496         return ret_ref;
42497 }
42498
42499 void  __attribute__((export_name("TS_RouteHintHop_set_htlc_maximum_msat"))) TS_RouteHintHop_set_htlc_maximum_msat(uint64_t this_ptr, uint64_t val) {
42500         LDKRouteHintHop this_ptr_conv;
42501         this_ptr_conv.inner = untag_ptr(this_ptr);
42502         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42504         this_ptr_conv.is_owned = false;
42505         void* val_ptr = untag_ptr(val);
42506         CHECK_ACCESS(val_ptr);
42507         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
42508         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
42509         RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
42510 }
42511
42512 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) {
42513         LDKPublicKey src_node_id_arg_ref;
42514         CHECK(src_node_id_arg->arr_len == 33);
42515         memcpy(src_node_id_arg_ref.compressed_form, src_node_id_arg->elems, 33); FREE(src_node_id_arg);
42516         LDKRoutingFees fees_arg_conv;
42517         fees_arg_conv.inner = untag_ptr(fees_arg);
42518         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
42519         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
42520         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
42521         void* htlc_minimum_msat_arg_ptr = untag_ptr(htlc_minimum_msat_arg);
42522         CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
42523         LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
42524         htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_minimum_msat_arg));
42525         void* htlc_maximum_msat_arg_ptr = untag_ptr(htlc_maximum_msat_arg);
42526         CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
42527         LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
42528         htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_maximum_msat_arg));
42529         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);
42530         uint64_t ret_ref = 0;
42531         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42532         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42533         return ret_ref;
42534 }
42535
42536 static inline uint64_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
42537         LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
42538         uint64_t ret_ref = 0;
42539         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42540         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42541         return ret_ref;
42542 }
42543 int64_t  __attribute__((export_name("TS_RouteHintHop_clone_ptr"))) TS_RouteHintHop_clone_ptr(uint64_t arg) {
42544         LDKRouteHintHop arg_conv;
42545         arg_conv.inner = untag_ptr(arg);
42546         arg_conv.is_owned = ptr_is_owned(arg);
42547         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42548         arg_conv.is_owned = false;
42549         int64_t ret_conv = RouteHintHop_clone_ptr(&arg_conv);
42550         return ret_conv;
42551 }
42552
42553 uint64_t  __attribute__((export_name("TS_RouteHintHop_clone"))) TS_RouteHintHop_clone(uint64_t orig) {
42554         LDKRouteHintHop orig_conv;
42555         orig_conv.inner = untag_ptr(orig);
42556         orig_conv.is_owned = ptr_is_owned(orig);
42557         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42558         orig_conv.is_owned = false;
42559         LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
42560         uint64_t ret_ref = 0;
42561         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42562         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42563         return ret_ref;
42564 }
42565
42566 int64_t  __attribute__((export_name("TS_RouteHintHop_hash"))) TS_RouteHintHop_hash(uint64_t o) {
42567         LDKRouteHintHop o_conv;
42568         o_conv.inner = untag_ptr(o);
42569         o_conv.is_owned = ptr_is_owned(o);
42570         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42571         o_conv.is_owned = false;
42572         int64_t ret_conv = RouteHintHop_hash(&o_conv);
42573         return ret_conv;
42574 }
42575
42576 jboolean  __attribute__((export_name("TS_RouteHintHop_eq"))) TS_RouteHintHop_eq(uint64_t a, uint64_t b) {
42577         LDKRouteHintHop a_conv;
42578         a_conv.inner = untag_ptr(a);
42579         a_conv.is_owned = ptr_is_owned(a);
42580         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42581         a_conv.is_owned = false;
42582         LDKRouteHintHop b_conv;
42583         b_conv.inner = untag_ptr(b);
42584         b_conv.is_owned = ptr_is_owned(b);
42585         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42586         b_conv.is_owned = false;
42587         jboolean ret_conv = RouteHintHop_eq(&a_conv, &b_conv);
42588         return ret_conv;
42589 }
42590
42591 int8_tArray  __attribute__((export_name("TS_RouteHintHop_write"))) TS_RouteHintHop_write(uint64_t obj) {
42592         LDKRouteHintHop obj_conv;
42593         obj_conv.inner = untag_ptr(obj);
42594         obj_conv.is_owned = ptr_is_owned(obj);
42595         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42596         obj_conv.is_owned = false;
42597         LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
42598         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42599         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42600         CVec_u8Z_free(ret_var);
42601         return ret_arr;
42602 }
42603
42604 uint64_t  __attribute__((export_name("TS_RouteHintHop_read"))) TS_RouteHintHop_read(int8_tArray ser) {
42605         LDKu8slice ser_ref;
42606         ser_ref.datalen = ser->arr_len;
42607         ser_ref.data = ser->elems;
42608         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
42609         *ret_conv = RouteHintHop_read(ser_ref);
42610         FREE(ser);
42611         return tag_ptr(ret_conv, true);
42612 }
42613
42614 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) {
42615         LDKPublicKey our_node_pubkey_ref;
42616         CHECK(our_node_pubkey->arr_len == 33);
42617         memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
42618         LDKRouteParameters route_params_conv;
42619         route_params_conv.inner = untag_ptr(route_params);
42620         route_params_conv.is_owned = ptr_is_owned(route_params);
42621         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
42622         route_params_conv.is_owned = false;
42623         LDKNetworkGraph network_graph_conv;
42624         network_graph_conv.inner = untag_ptr(network_graph);
42625         network_graph_conv.is_owned = ptr_is_owned(network_graph);
42626         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
42627         network_graph_conv.is_owned = false;
42628         LDKCVec_ChannelDetailsZ first_hops_constr;
42629         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
42630         if (first_hops != 0) {
42631                 first_hops_constr.datalen = first_hops->arr_len;
42632                 if (first_hops_constr.datalen > 0)
42633                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
42634                 else
42635                         first_hops_constr.data = NULL;
42636                 uint64_t* first_hops_vals = first_hops->elems;
42637                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
42638                         uint64_t first_hops_conv_16 = first_hops_vals[q];
42639                         LDKChannelDetails first_hops_conv_16_conv;
42640                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
42641                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
42642                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
42643                         first_hops_conv_16_conv.is_owned = false;
42644                         first_hops_constr.data[q] = first_hops_conv_16_conv;
42645                 }
42646                 FREE(first_hops);
42647                 first_hops_ptr = &first_hops_constr;
42648         }
42649         void* logger_ptr = untag_ptr(logger);
42650         CHECK_ACCESS(logger_ptr);
42651         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
42652         if (logger_conv.free == LDKLogger_JCalls_free) {
42653                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42654                 LDKLogger_JCalls_cloned(&logger_conv);
42655         }
42656         void* scorer_ptr = untag_ptr(scorer);
42657         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
42658         LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
42659         unsigned char random_seed_bytes_arr[32];
42660         CHECK(random_seed_bytes->arr_len == 32);
42661         memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
42662         unsigned char (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
42663         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
42664         *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);
42665         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
42666         return tag_ptr(ret_conv, true);
42667 }
42668
42669 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) {
42670         LDKPublicKey our_node_pubkey_ref;
42671         CHECK(our_node_pubkey->arr_len == 33);
42672         memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
42673         LDKCVec_PublicKeyZ hops_constr;
42674         hops_constr.datalen = hops->arr_len;
42675         if (hops_constr.datalen > 0)
42676                 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
42677         else
42678                 hops_constr.data = NULL;
42679         int8_tArray* hops_vals = (void*) hops->elems;
42680         for (size_t m = 0; m < hops_constr.datalen; m++) {
42681                 int8_tArray hops_conv_12 = hops_vals[m];
42682                 LDKPublicKey hops_conv_12_ref;
42683                 CHECK(hops_conv_12->arr_len == 33);
42684                 memcpy(hops_conv_12_ref.compressed_form, hops_conv_12->elems, 33); FREE(hops_conv_12);
42685                 hops_constr.data[m] = hops_conv_12_ref;
42686         }
42687         FREE(hops);
42688         LDKRouteParameters route_params_conv;
42689         route_params_conv.inner = untag_ptr(route_params);
42690         route_params_conv.is_owned = ptr_is_owned(route_params);
42691         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
42692         route_params_conv.is_owned = false;
42693         LDKNetworkGraph network_graph_conv;
42694         network_graph_conv.inner = untag_ptr(network_graph);
42695         network_graph_conv.is_owned = ptr_is_owned(network_graph);
42696         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
42697         network_graph_conv.is_owned = false;
42698         void* logger_ptr = untag_ptr(logger);
42699         CHECK_ACCESS(logger_ptr);
42700         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
42701         if (logger_conv.free == LDKLogger_JCalls_free) {
42702                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42703                 LDKLogger_JCalls_cloned(&logger_conv);
42704         }
42705         unsigned char random_seed_bytes_arr[32];
42706         CHECK(random_seed_bytes->arr_len == 32);
42707         memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
42708         unsigned char (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
42709         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
42710         *ret_conv = build_route_from_hops(our_node_pubkey_ref, hops_constr, &route_params_conv, &network_graph_conv, logger_conv, random_seed_bytes_ref);
42711         return tag_ptr(ret_conv, true);
42712 }
42713
42714 void  __attribute__((export_name("TS_Score_free"))) TS_Score_free(uint64_t this_ptr) {
42715         if (!ptr_is_owned(this_ptr)) return;
42716         void* this_ptr_ptr = untag_ptr(this_ptr);
42717         CHECK_ACCESS(this_ptr_ptr);
42718         LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
42719         FREE(untag_ptr(this_ptr));
42720         Score_free(this_ptr_conv);
42721 }
42722
42723 void  __attribute__((export_name("TS_LockableScore_free"))) TS_LockableScore_free(uint64_t this_ptr) {
42724         if (!ptr_is_owned(this_ptr)) return;
42725         void* this_ptr_ptr = untag_ptr(this_ptr);
42726         CHECK_ACCESS(this_ptr_ptr);
42727         LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
42728         FREE(untag_ptr(this_ptr));
42729         LockableScore_free(this_ptr_conv);
42730 }
42731
42732 void  __attribute__((export_name("TS_WriteableScore_free"))) TS_WriteableScore_free(uint64_t this_ptr) {
42733         if (!ptr_is_owned(this_ptr)) return;
42734         void* this_ptr_ptr = untag_ptr(this_ptr);
42735         CHECK_ACCESS(this_ptr_ptr);
42736         LDKWriteableScore this_ptr_conv = *(LDKWriteableScore*)(this_ptr_ptr);
42737         FREE(untag_ptr(this_ptr));
42738         WriteableScore_free(this_ptr_conv);
42739 }
42740
42741 void  __attribute__((export_name("TS_MultiThreadedLockableScore_free"))) TS_MultiThreadedLockableScore_free(uint64_t this_obj) {
42742         LDKMultiThreadedLockableScore this_obj_conv;
42743         this_obj_conv.inner = untag_ptr(this_obj);
42744         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42745         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42746         MultiThreadedLockableScore_free(this_obj_conv);
42747 }
42748
42749 void  __attribute__((export_name("TS_MultiThreadedScoreLock_free"))) TS_MultiThreadedScoreLock_free(uint64_t this_obj) {
42750         LDKMultiThreadedScoreLock this_obj_conv;
42751         this_obj_conv.inner = untag_ptr(this_obj);
42752         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42754         MultiThreadedScoreLock_free(this_obj_conv);
42755 }
42756
42757 uint64_t  __attribute__((export_name("TS_MultiThreadedScoreLock_as_Score"))) TS_MultiThreadedScoreLock_as_Score(uint64_t this_arg) {
42758         LDKMultiThreadedScoreLock this_arg_conv;
42759         this_arg_conv.inner = untag_ptr(this_arg);
42760         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42761         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42762         this_arg_conv.is_owned = false;
42763         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
42764         *ret_ret = MultiThreadedScoreLock_as_Score(&this_arg_conv);
42765         return tag_ptr(ret_ret, true);
42766 }
42767
42768 int8_tArray  __attribute__((export_name("TS_MultiThreadedScoreLock_write"))) TS_MultiThreadedScoreLock_write(uint64_t obj) {
42769         LDKMultiThreadedScoreLock obj_conv;
42770         obj_conv.inner = untag_ptr(obj);
42771         obj_conv.is_owned = ptr_is_owned(obj);
42772         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42773         obj_conv.is_owned = false;
42774         LDKCVec_u8Z ret_var = MultiThreadedScoreLock_write(&obj_conv);
42775         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42776         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42777         CVec_u8Z_free(ret_var);
42778         return ret_arr;
42779 }
42780
42781 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_as_LockableScore"))) TS_MultiThreadedLockableScore_as_LockableScore(uint64_t this_arg) {
42782         LDKMultiThreadedLockableScore this_arg_conv;
42783         this_arg_conv.inner = untag_ptr(this_arg);
42784         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42786         this_arg_conv.is_owned = false;
42787         LDKLockableScore* ret_ret = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
42788         *ret_ret = MultiThreadedLockableScore_as_LockableScore(&this_arg_conv);
42789         return tag_ptr(ret_ret, true);
42790 }
42791
42792 int8_tArray  __attribute__((export_name("TS_MultiThreadedLockableScore_write"))) TS_MultiThreadedLockableScore_write(uint64_t obj) {
42793         LDKMultiThreadedLockableScore obj_conv;
42794         obj_conv.inner = untag_ptr(obj);
42795         obj_conv.is_owned = ptr_is_owned(obj);
42796         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42797         obj_conv.is_owned = false;
42798         LDKCVec_u8Z ret_var = MultiThreadedLockableScore_write(&obj_conv);
42799         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42800         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42801         CVec_u8Z_free(ret_var);
42802         return ret_arr;
42803 }
42804
42805 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_as_WriteableScore"))) TS_MultiThreadedLockableScore_as_WriteableScore(uint64_t this_arg) {
42806         LDKMultiThreadedLockableScore this_arg_conv;
42807         this_arg_conv.inner = untag_ptr(this_arg);
42808         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42810         this_arg_conv.is_owned = false;
42811         LDKWriteableScore* ret_ret = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
42812         *ret_ret = MultiThreadedLockableScore_as_WriteableScore(&this_arg_conv);
42813         return tag_ptr(ret_ret, true);
42814 }
42815
42816 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_new"))) TS_MultiThreadedLockableScore_new(uint64_t score) {
42817         void* score_ptr = untag_ptr(score);
42818         CHECK_ACCESS(score_ptr);
42819         LDKScore score_conv = *(LDKScore*)(score_ptr);
42820         if (score_conv.free == LDKScore_JCalls_free) {
42821                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42822                 LDKScore_JCalls_cloned(&score_conv);
42823         }
42824         LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
42825         uint64_t ret_ref = 0;
42826         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42827         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42828         return ret_ref;
42829 }
42830
42831 void  __attribute__((export_name("TS_ChannelUsage_free"))) TS_ChannelUsage_free(uint64_t this_obj) {
42832         LDKChannelUsage this_obj_conv;
42833         this_obj_conv.inner = untag_ptr(this_obj);
42834         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42836         ChannelUsage_free(this_obj_conv);
42837 }
42838
42839 int64_t  __attribute__((export_name("TS_ChannelUsage_get_amount_msat"))) TS_ChannelUsage_get_amount_msat(uint64_t this_ptr) {
42840         LDKChannelUsage this_ptr_conv;
42841         this_ptr_conv.inner = untag_ptr(this_ptr);
42842         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42844         this_ptr_conv.is_owned = false;
42845         int64_t ret_conv = ChannelUsage_get_amount_msat(&this_ptr_conv);
42846         return ret_conv;
42847 }
42848
42849 void  __attribute__((export_name("TS_ChannelUsage_set_amount_msat"))) TS_ChannelUsage_set_amount_msat(uint64_t this_ptr, int64_t val) {
42850         LDKChannelUsage this_ptr_conv;
42851         this_ptr_conv.inner = untag_ptr(this_ptr);
42852         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42854         this_ptr_conv.is_owned = false;
42855         ChannelUsage_set_amount_msat(&this_ptr_conv, val);
42856 }
42857
42858 int64_t  __attribute__((export_name("TS_ChannelUsage_get_inflight_htlc_msat"))) TS_ChannelUsage_get_inflight_htlc_msat(uint64_t this_ptr) {
42859         LDKChannelUsage this_ptr_conv;
42860         this_ptr_conv.inner = untag_ptr(this_ptr);
42861         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42863         this_ptr_conv.is_owned = false;
42864         int64_t ret_conv = ChannelUsage_get_inflight_htlc_msat(&this_ptr_conv);
42865         return ret_conv;
42866 }
42867
42868 void  __attribute__((export_name("TS_ChannelUsage_set_inflight_htlc_msat"))) TS_ChannelUsage_set_inflight_htlc_msat(uint64_t this_ptr, int64_t val) {
42869         LDKChannelUsage this_ptr_conv;
42870         this_ptr_conv.inner = untag_ptr(this_ptr);
42871         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42873         this_ptr_conv.is_owned = false;
42874         ChannelUsage_set_inflight_htlc_msat(&this_ptr_conv, val);
42875 }
42876
42877 uint64_t  __attribute__((export_name("TS_ChannelUsage_get_effective_capacity"))) TS_ChannelUsage_get_effective_capacity(uint64_t this_ptr) {
42878         LDKChannelUsage this_ptr_conv;
42879         this_ptr_conv.inner = untag_ptr(this_ptr);
42880         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42882         this_ptr_conv.is_owned = false;
42883         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
42884         *ret_copy = ChannelUsage_get_effective_capacity(&this_ptr_conv);
42885         uint64_t ret_ref = tag_ptr(ret_copy, true);
42886         return ret_ref;
42887 }
42888
42889 void  __attribute__((export_name("TS_ChannelUsage_set_effective_capacity"))) TS_ChannelUsage_set_effective_capacity(uint64_t this_ptr, uint64_t val) {
42890         LDKChannelUsage this_ptr_conv;
42891         this_ptr_conv.inner = untag_ptr(this_ptr);
42892         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42894         this_ptr_conv.is_owned = false;
42895         void* val_ptr = untag_ptr(val);
42896         CHECK_ACCESS(val_ptr);
42897         LDKEffectiveCapacity val_conv = *(LDKEffectiveCapacity*)(val_ptr);
42898         val_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(val));
42899         ChannelUsage_set_effective_capacity(&this_ptr_conv, val_conv);
42900 }
42901
42902 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) {
42903         void* effective_capacity_arg_ptr = untag_ptr(effective_capacity_arg);
42904         CHECK_ACCESS(effective_capacity_arg_ptr);
42905         LDKEffectiveCapacity effective_capacity_arg_conv = *(LDKEffectiveCapacity*)(effective_capacity_arg_ptr);
42906         effective_capacity_arg_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(effective_capacity_arg));
42907         LDKChannelUsage ret_var = ChannelUsage_new(amount_msat_arg, inflight_htlc_msat_arg, effective_capacity_arg_conv);
42908         uint64_t ret_ref = 0;
42909         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42910         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42911         return ret_ref;
42912 }
42913
42914 static inline uint64_t ChannelUsage_clone_ptr(LDKChannelUsage *NONNULL_PTR arg) {
42915         LDKChannelUsage ret_var = ChannelUsage_clone(arg);
42916         uint64_t ret_ref = 0;
42917         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42918         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42919         return ret_ref;
42920 }
42921 int64_t  __attribute__((export_name("TS_ChannelUsage_clone_ptr"))) TS_ChannelUsage_clone_ptr(uint64_t arg) {
42922         LDKChannelUsage arg_conv;
42923         arg_conv.inner = untag_ptr(arg);
42924         arg_conv.is_owned = ptr_is_owned(arg);
42925         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42926         arg_conv.is_owned = false;
42927         int64_t ret_conv = ChannelUsage_clone_ptr(&arg_conv);
42928         return ret_conv;
42929 }
42930
42931 uint64_t  __attribute__((export_name("TS_ChannelUsage_clone"))) TS_ChannelUsage_clone(uint64_t orig) {
42932         LDKChannelUsage orig_conv;
42933         orig_conv.inner = untag_ptr(orig);
42934         orig_conv.is_owned = ptr_is_owned(orig);
42935         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42936         orig_conv.is_owned = false;
42937         LDKChannelUsage ret_var = ChannelUsage_clone(&orig_conv);
42938         uint64_t ret_ref = 0;
42939         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42940         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42941         return ret_ref;
42942 }
42943
42944 void  __attribute__((export_name("TS_FixedPenaltyScorer_free"))) TS_FixedPenaltyScorer_free(uint64_t this_obj) {
42945         LDKFixedPenaltyScorer this_obj_conv;
42946         this_obj_conv.inner = untag_ptr(this_obj);
42947         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42949         FixedPenaltyScorer_free(this_obj_conv);
42950 }
42951
42952 static inline uint64_t FixedPenaltyScorer_clone_ptr(LDKFixedPenaltyScorer *NONNULL_PTR arg) {
42953         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(arg);
42954         uint64_t ret_ref = 0;
42955         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42956         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42957         return ret_ref;
42958 }
42959 int64_t  __attribute__((export_name("TS_FixedPenaltyScorer_clone_ptr"))) TS_FixedPenaltyScorer_clone_ptr(uint64_t arg) {
42960         LDKFixedPenaltyScorer arg_conv;
42961         arg_conv.inner = untag_ptr(arg);
42962         arg_conv.is_owned = ptr_is_owned(arg);
42963         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42964         arg_conv.is_owned = false;
42965         int64_t ret_conv = FixedPenaltyScorer_clone_ptr(&arg_conv);
42966         return ret_conv;
42967 }
42968
42969 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_clone"))) TS_FixedPenaltyScorer_clone(uint64_t orig) {
42970         LDKFixedPenaltyScorer orig_conv;
42971         orig_conv.inner = untag_ptr(orig);
42972         orig_conv.is_owned = ptr_is_owned(orig);
42973         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42974         orig_conv.is_owned = false;
42975         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(&orig_conv);
42976         uint64_t ret_ref = 0;
42977         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42978         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42979         return ret_ref;
42980 }
42981
42982 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_with_penalty"))) TS_FixedPenaltyScorer_with_penalty(int64_t penalty_msat) {
42983         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_with_penalty(penalty_msat);
42984         uint64_t ret_ref = 0;
42985         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42986         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42987         return ret_ref;
42988 }
42989
42990 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_as_Score"))) TS_FixedPenaltyScorer_as_Score(uint64_t this_arg) {
42991         LDKFixedPenaltyScorer this_arg_conv;
42992         this_arg_conv.inner = untag_ptr(this_arg);
42993         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42995         this_arg_conv.is_owned = false;
42996         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
42997         *ret_ret = FixedPenaltyScorer_as_Score(&this_arg_conv);
42998         return tag_ptr(ret_ret, true);
42999 }
43000
43001 int8_tArray  __attribute__((export_name("TS_FixedPenaltyScorer_write"))) TS_FixedPenaltyScorer_write(uint64_t obj) {
43002         LDKFixedPenaltyScorer obj_conv;
43003         obj_conv.inner = untag_ptr(obj);
43004         obj_conv.is_owned = ptr_is_owned(obj);
43005         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43006         obj_conv.is_owned = false;
43007         LDKCVec_u8Z ret_var = FixedPenaltyScorer_write(&obj_conv);
43008         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43009         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43010         CVec_u8Z_free(ret_var);
43011         return ret_arr;
43012 }
43013
43014 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_read"))) TS_FixedPenaltyScorer_read(int8_tArray ser, int64_t arg) {
43015         LDKu8slice ser_ref;
43016         ser_ref.datalen = ser->arr_len;
43017         ser_ref.data = ser->elems;
43018         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
43019         *ret_conv = FixedPenaltyScorer_read(ser_ref, arg);
43020         FREE(ser);
43021         return tag_ptr(ret_conv, true);
43022 }
43023
43024 void  __attribute__((export_name("TS_ProbabilisticScorer_free"))) TS_ProbabilisticScorer_free(uint64_t this_obj) {
43025         LDKProbabilisticScorer this_obj_conv;
43026         this_obj_conv.inner = untag_ptr(this_obj);
43027         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43029         ProbabilisticScorer_free(this_obj_conv);
43030 }
43031
43032 void  __attribute__((export_name("TS_ProbabilisticScoringParameters_free"))) TS_ProbabilisticScoringParameters_free(uint64_t this_obj) {
43033         LDKProbabilisticScoringParameters this_obj_conv;
43034         this_obj_conv.inner = untag_ptr(this_obj);
43035         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43037         ProbabilisticScoringParameters_free(this_obj_conv);
43038 }
43039
43040 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_base_penalty_msat"))) TS_ProbabilisticScoringParameters_get_base_penalty_msat(uint64_t this_ptr) {
43041         LDKProbabilisticScoringParameters this_ptr_conv;
43042         this_ptr_conv.inner = untag_ptr(this_ptr);
43043         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43045         this_ptr_conv.is_owned = false;
43046         int64_t ret_conv = ProbabilisticScoringParameters_get_base_penalty_msat(&this_ptr_conv);
43047         return ret_conv;
43048 }
43049
43050 void  __attribute__((export_name("TS_ProbabilisticScoringParameters_set_base_penalty_msat"))) TS_ProbabilisticScoringParameters_set_base_penalty_msat(uint64_t this_ptr, int64_t val) {
43051         LDKProbabilisticScoringParameters this_ptr_conv;
43052         this_ptr_conv.inner = untag_ptr(this_ptr);
43053         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43055         this_ptr_conv.is_owned = false;
43056         ProbabilisticScoringParameters_set_base_penalty_msat(&this_ptr_conv, val);
43057 }
43058
43059 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) {
43060         LDKProbabilisticScoringParameters this_ptr_conv;
43061         this_ptr_conv.inner = untag_ptr(this_ptr);
43062         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43063         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43064         this_ptr_conv.is_owned = false;
43065         int64_t ret_conv = ProbabilisticScoringParameters_get_base_penalty_amount_multiplier_msat(&this_ptr_conv);
43066         return ret_conv;
43067 }
43068
43069 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) {
43070         LDKProbabilisticScoringParameters this_ptr_conv;
43071         this_ptr_conv.inner = untag_ptr(this_ptr);
43072         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43074         this_ptr_conv.is_owned = false;
43075         ProbabilisticScoringParameters_set_base_penalty_amount_multiplier_msat(&this_ptr_conv, val);
43076 }
43077
43078 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat"))) TS_ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(uint64_t this_ptr) {
43079         LDKProbabilisticScoringParameters this_ptr_conv;
43080         this_ptr_conv.inner = untag_ptr(this_ptr);
43081         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43083         this_ptr_conv.is_owned = false;
43084         int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(&this_ptr_conv);
43085         return ret_conv;
43086 }
43087
43088 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) {
43089         LDKProbabilisticScoringParameters this_ptr_conv;
43090         this_ptr_conv.inner = untag_ptr(this_ptr);
43091         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43093         this_ptr_conv.is_owned = false;
43094         ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
43095 }
43096
43097 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_liquidity_offset_half_life"))) TS_ProbabilisticScoringParameters_get_liquidity_offset_half_life(uint64_t this_ptr) {
43098         LDKProbabilisticScoringParameters this_ptr_conv;
43099         this_ptr_conv.inner = untag_ptr(this_ptr);
43100         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43101         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43102         this_ptr_conv.is_owned = false;
43103         int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_offset_half_life(&this_ptr_conv);
43104         return ret_conv;
43105 }
43106
43107 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) {
43108         LDKProbabilisticScoringParameters this_ptr_conv;
43109         this_ptr_conv.inner = untag_ptr(this_ptr);
43110         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43112         this_ptr_conv.is_owned = false;
43113         ProbabilisticScoringParameters_set_liquidity_offset_half_life(&this_ptr_conv, val);
43114 }
43115
43116 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) {
43117         LDKProbabilisticScoringParameters this_ptr_conv;
43118         this_ptr_conv.inner = untag_ptr(this_ptr);
43119         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43121         this_ptr_conv.is_owned = false;
43122         int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
43123         return ret_conv;
43124 }
43125
43126 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) {
43127         LDKProbabilisticScoringParameters this_ptr_conv;
43128         this_ptr_conv.inner = untag_ptr(this_ptr);
43129         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43131         this_ptr_conv.is_owned = false;
43132         ProbabilisticScoringParameters_set_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
43133 }
43134
43135 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_anti_probing_penalty_msat"))) TS_ProbabilisticScoringParameters_get_anti_probing_penalty_msat(uint64_t this_ptr) {
43136         LDKProbabilisticScoringParameters this_ptr_conv;
43137         this_ptr_conv.inner = untag_ptr(this_ptr);
43138         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43140         this_ptr_conv.is_owned = false;
43141         int64_t ret_conv = ProbabilisticScoringParameters_get_anti_probing_penalty_msat(&this_ptr_conv);
43142         return ret_conv;
43143 }
43144
43145 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) {
43146         LDKProbabilisticScoringParameters this_ptr_conv;
43147         this_ptr_conv.inner = untag_ptr(this_ptr);
43148         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43150         this_ptr_conv.is_owned = false;
43151         ProbabilisticScoringParameters_set_anti_probing_penalty_msat(&this_ptr_conv, val);
43152 }
43153
43154 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_considered_impossible_penalty_msat"))) TS_ProbabilisticScoringParameters_get_considered_impossible_penalty_msat(uint64_t this_ptr) {
43155         LDKProbabilisticScoringParameters this_ptr_conv;
43156         this_ptr_conv.inner = untag_ptr(this_ptr);
43157         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43159         this_ptr_conv.is_owned = false;
43160         int64_t ret_conv = ProbabilisticScoringParameters_get_considered_impossible_penalty_msat(&this_ptr_conv);
43161         return ret_conv;
43162 }
43163
43164 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) {
43165         LDKProbabilisticScoringParameters this_ptr_conv;
43166         this_ptr_conv.inner = untag_ptr(this_ptr);
43167         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43169         this_ptr_conv.is_owned = false;
43170         ProbabilisticScoringParameters_set_considered_impossible_penalty_msat(&this_ptr_conv, val);
43171 }
43172
43173 static inline uint64_t ProbabilisticScoringParameters_clone_ptr(LDKProbabilisticScoringParameters *NONNULL_PTR arg) {
43174         LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(arg);
43175         uint64_t ret_ref = 0;
43176         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43177         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43178         return ret_ref;
43179 }
43180 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_clone_ptr"))) TS_ProbabilisticScoringParameters_clone_ptr(uint64_t arg) {
43181         LDKProbabilisticScoringParameters arg_conv;
43182         arg_conv.inner = untag_ptr(arg);
43183         arg_conv.is_owned = ptr_is_owned(arg);
43184         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43185         arg_conv.is_owned = false;
43186         int64_t ret_conv = ProbabilisticScoringParameters_clone_ptr(&arg_conv);
43187         return ret_conv;
43188 }
43189
43190 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_clone"))) TS_ProbabilisticScoringParameters_clone(uint64_t orig) {
43191         LDKProbabilisticScoringParameters orig_conv;
43192         orig_conv.inner = untag_ptr(orig);
43193         orig_conv.is_owned = ptr_is_owned(orig);
43194         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43195         orig_conv.is_owned = false;
43196         LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(&orig_conv);
43197         uint64_t ret_ref = 0;
43198         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43199         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43200         return ret_ref;
43201 }
43202
43203 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_new"))) TS_ProbabilisticScorer_new(uint64_t params, uint64_t network_graph, uint64_t logger) {
43204         LDKProbabilisticScoringParameters params_conv;
43205         params_conv.inner = untag_ptr(params);
43206         params_conv.is_owned = ptr_is_owned(params);
43207         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
43208         params_conv = ProbabilisticScoringParameters_clone(&params_conv);
43209         LDKNetworkGraph network_graph_conv;
43210         network_graph_conv.inner = untag_ptr(network_graph);
43211         network_graph_conv.is_owned = ptr_is_owned(network_graph);
43212         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
43213         network_graph_conv.is_owned = false;
43214         void* logger_ptr = untag_ptr(logger);
43215         CHECK_ACCESS(logger_ptr);
43216         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
43217         if (logger_conv.free == LDKLogger_JCalls_free) {
43218                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43219                 LDKLogger_JCalls_cloned(&logger_conv);
43220         }
43221         LDKProbabilisticScorer ret_var = ProbabilisticScorer_new(params_conv, &network_graph_conv, logger_conv);
43222         uint64_t ret_ref = 0;
43223         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43224         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43225         return ret_ref;
43226 }
43227
43228 void  __attribute__((export_name("TS_ProbabilisticScorer_debug_log_liquidity_stats"))) TS_ProbabilisticScorer_debug_log_liquidity_stats(uint64_t this_arg) {
43229         LDKProbabilisticScorer this_arg_conv;
43230         this_arg_conv.inner = untag_ptr(this_arg);
43231         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43233         this_arg_conv.is_owned = false;
43234         ProbabilisticScorer_debug_log_liquidity_stats(&this_arg_conv);
43235 }
43236
43237 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) {
43238         LDKProbabilisticScorer this_arg_conv;
43239         this_arg_conv.inner = untag_ptr(this_arg);
43240         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43242         this_arg_conv.is_owned = false;
43243         LDKNodeId target_conv;
43244         target_conv.inner = untag_ptr(target);
43245         target_conv.is_owned = ptr_is_owned(target);
43246         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
43247         target_conv.is_owned = false;
43248         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
43249         *ret_copy = ProbabilisticScorer_estimated_channel_liquidity_range(&this_arg_conv, scid, &target_conv);
43250         uint64_t ret_ref = tag_ptr(ret_copy, true);
43251         return ret_ref;
43252 }
43253
43254 void  __attribute__((export_name("TS_ProbabilisticScorer_add_banned"))) TS_ProbabilisticScorer_add_banned(uint64_t this_arg, uint64_t node_id) {
43255         LDKProbabilisticScorer this_arg_conv;
43256         this_arg_conv.inner = untag_ptr(this_arg);
43257         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43259         this_arg_conv.is_owned = false;
43260         LDKNodeId node_id_conv;
43261         node_id_conv.inner = untag_ptr(node_id);
43262         node_id_conv.is_owned = ptr_is_owned(node_id);
43263         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
43264         node_id_conv.is_owned = false;
43265         ProbabilisticScorer_add_banned(&this_arg_conv, &node_id_conv);
43266 }
43267
43268 void  __attribute__((export_name("TS_ProbabilisticScorer_remove_banned"))) TS_ProbabilisticScorer_remove_banned(uint64_t this_arg, uint64_t node_id) {
43269         LDKProbabilisticScorer this_arg_conv;
43270         this_arg_conv.inner = untag_ptr(this_arg);
43271         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43273         this_arg_conv.is_owned = false;
43274         LDKNodeId node_id_conv;
43275         node_id_conv.inner = untag_ptr(node_id);
43276         node_id_conv.is_owned = ptr_is_owned(node_id);
43277         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
43278         node_id_conv.is_owned = false;
43279         ProbabilisticScorer_remove_banned(&this_arg_conv, &node_id_conv);
43280 }
43281
43282 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) {
43283         LDKProbabilisticScorer this_arg_conv;
43284         this_arg_conv.inner = untag_ptr(this_arg);
43285         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43287         this_arg_conv.is_owned = false;
43288         LDKNodeId node_id_conv;
43289         node_id_conv.inner = untag_ptr(node_id);
43290         node_id_conv.is_owned = ptr_is_owned(node_id);
43291         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
43292         node_id_conv.is_owned = false;
43293         ProbabilisticScorer_set_manual_penalty(&this_arg_conv, &node_id_conv, penalty);
43294 }
43295
43296 void  __attribute__((export_name("TS_ProbabilisticScorer_remove_manual_penalty"))) TS_ProbabilisticScorer_remove_manual_penalty(uint64_t this_arg, uint64_t node_id) {
43297         LDKProbabilisticScorer this_arg_conv;
43298         this_arg_conv.inner = untag_ptr(this_arg);
43299         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43301         this_arg_conv.is_owned = false;
43302         LDKNodeId node_id_conv;
43303         node_id_conv.inner = untag_ptr(node_id);
43304         node_id_conv.is_owned = ptr_is_owned(node_id);
43305         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
43306         node_id_conv.is_owned = false;
43307         ProbabilisticScorer_remove_manual_penalty(&this_arg_conv, &node_id_conv);
43308 }
43309
43310 void  __attribute__((export_name("TS_ProbabilisticScorer_clear_manual_penalties"))) TS_ProbabilisticScorer_clear_manual_penalties(uint64_t this_arg) {
43311         LDKProbabilisticScorer this_arg_conv;
43312         this_arg_conv.inner = untag_ptr(this_arg);
43313         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43315         this_arg_conv.is_owned = false;
43316         ProbabilisticScorer_clear_manual_penalties(&this_arg_conv);
43317 }
43318
43319 void  __attribute__((export_name("TS_ProbabilisticScoringParameters_add_banned_from_list"))) TS_ProbabilisticScoringParameters_add_banned_from_list(uint64_t this_arg, uint64_tArray node_ids) {
43320         LDKProbabilisticScoringParameters this_arg_conv;
43321         this_arg_conv.inner = untag_ptr(this_arg);
43322         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43324         this_arg_conv.is_owned = false;
43325         LDKCVec_NodeIdZ node_ids_constr;
43326         node_ids_constr.datalen = node_ids->arr_len;
43327         if (node_ids_constr.datalen > 0)
43328                 node_ids_constr.data = MALLOC(node_ids_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
43329         else
43330                 node_ids_constr.data = NULL;
43331         uint64_t* node_ids_vals = node_ids->elems;
43332         for (size_t i = 0; i < node_ids_constr.datalen; i++) {
43333                 uint64_t node_ids_conv_8 = node_ids_vals[i];
43334                 LDKNodeId node_ids_conv_8_conv;
43335                 node_ids_conv_8_conv.inner = untag_ptr(node_ids_conv_8);
43336                 node_ids_conv_8_conv.is_owned = ptr_is_owned(node_ids_conv_8);
43337                 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_ids_conv_8_conv);
43338                 node_ids_conv_8_conv = NodeId_clone(&node_ids_conv_8_conv);
43339                 node_ids_constr.data[i] = node_ids_conv_8_conv;
43340         }
43341         FREE(node_ids);
43342         ProbabilisticScoringParameters_add_banned_from_list(&this_arg_conv, node_ids_constr);
43343 }
43344
43345 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_default"))) TS_ProbabilisticScoringParameters_default() {
43346         LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_default();
43347         uint64_t ret_ref = 0;
43348         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43349         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43350         return ret_ref;
43351 }
43352
43353 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_as_Score"))) TS_ProbabilisticScorer_as_Score(uint64_t this_arg) {
43354         LDKProbabilisticScorer this_arg_conv;
43355         this_arg_conv.inner = untag_ptr(this_arg);
43356         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43358         this_arg_conv.is_owned = false;
43359         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
43360         *ret_ret = ProbabilisticScorer_as_Score(&this_arg_conv);
43361         return tag_ptr(ret_ret, true);
43362 }
43363
43364 int8_tArray  __attribute__((export_name("TS_ProbabilisticScorer_write"))) TS_ProbabilisticScorer_write(uint64_t obj) {
43365         LDKProbabilisticScorer obj_conv;
43366         obj_conv.inner = untag_ptr(obj);
43367         obj_conv.is_owned = ptr_is_owned(obj);
43368         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43369         obj_conv.is_owned = false;
43370         LDKCVec_u8Z ret_var = ProbabilisticScorer_write(&obj_conv);
43371         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43372         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43373         CVec_u8Z_free(ret_var);
43374         return ret_arr;
43375 }
43376
43377 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) {
43378         LDKu8slice ser_ref;
43379         ser_ref.datalen = ser->arr_len;
43380         ser_ref.data = ser->elems;
43381         LDKProbabilisticScoringParameters arg_a_conv;
43382         arg_a_conv.inner = untag_ptr(arg_a);
43383         arg_a_conv.is_owned = ptr_is_owned(arg_a);
43384         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_a_conv);
43385         arg_a_conv = ProbabilisticScoringParameters_clone(&arg_a_conv);
43386         LDKNetworkGraph arg_b_conv;
43387         arg_b_conv.inner = untag_ptr(arg_b);
43388         arg_b_conv.is_owned = ptr_is_owned(arg_b);
43389         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_b_conv);
43390         arg_b_conv.is_owned = false;
43391         void* arg_c_ptr = untag_ptr(arg_c);
43392         CHECK_ACCESS(arg_c_ptr);
43393         LDKLogger arg_c_conv = *(LDKLogger*)(arg_c_ptr);
43394         if (arg_c_conv.free == LDKLogger_JCalls_free) {
43395                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43396                 LDKLogger_JCalls_cloned(&arg_c_conv);
43397         }
43398         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
43399         *ret_conv = ProbabilisticScorer_read(ser_ref, arg_a_conv, &arg_b_conv, arg_c_conv);
43400         FREE(ser);
43401         return tag_ptr(ret_conv, true);
43402 }
43403
43404 void  __attribute__((export_name("TS_BlindedRoute_free"))) TS_BlindedRoute_free(uint64_t this_obj) {
43405         LDKBlindedRoute this_obj_conv;
43406         this_obj_conv.inner = untag_ptr(this_obj);
43407         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43409         BlindedRoute_free(this_obj_conv);
43410 }
43411
43412 void  __attribute__((export_name("TS_BlindedHop_free"))) TS_BlindedHop_free(uint64_t this_obj) {
43413         LDKBlindedHop this_obj_conv;
43414         this_obj_conv.inner = untag_ptr(this_obj);
43415         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43417         BlindedHop_free(this_obj_conv);
43418 }
43419
43420 uint64_t  __attribute__((export_name("TS_BlindedRoute_new"))) TS_BlindedRoute_new(ptrArray node_pks, uint64_t keys_manager) {
43421         LDKCVec_PublicKeyZ node_pks_constr;
43422         node_pks_constr.datalen = node_pks->arr_len;
43423         if (node_pks_constr.datalen > 0)
43424                 node_pks_constr.data = MALLOC(node_pks_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
43425         else
43426                 node_pks_constr.data = NULL;
43427         int8_tArray* node_pks_vals = (void*) node_pks->elems;
43428         for (size_t m = 0; m < node_pks_constr.datalen; m++) {
43429                 int8_tArray node_pks_conv_12 = node_pks_vals[m];
43430                 LDKPublicKey node_pks_conv_12_ref;
43431                 CHECK(node_pks_conv_12->arr_len == 33);
43432                 memcpy(node_pks_conv_12_ref.compressed_form, node_pks_conv_12->elems, 33); FREE(node_pks_conv_12);
43433                 node_pks_constr.data[m] = node_pks_conv_12_ref;
43434         }
43435         FREE(node_pks);
43436         void* keys_manager_ptr = untag_ptr(keys_manager);
43437         if (ptr_is_owned(keys_manager)) { CHECK_ACCESS(keys_manager_ptr); }
43438         LDKKeysInterface* keys_manager_conv = (LDKKeysInterface*)keys_manager_ptr;
43439         LDKCResult_BlindedRouteNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedRouteNoneZ), "LDKCResult_BlindedRouteNoneZ");
43440         *ret_conv = BlindedRoute_new(node_pks_constr, keys_manager_conv);
43441         return tag_ptr(ret_conv, true);
43442 }
43443
43444 int8_tArray  __attribute__((export_name("TS_BlindedRoute_write"))) TS_BlindedRoute_write(uint64_t obj) {
43445         LDKBlindedRoute obj_conv;
43446         obj_conv.inner = untag_ptr(obj);
43447         obj_conv.is_owned = ptr_is_owned(obj);
43448         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43449         obj_conv.is_owned = false;
43450         LDKCVec_u8Z ret_var = BlindedRoute_write(&obj_conv);
43451         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43452         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43453         CVec_u8Z_free(ret_var);
43454         return ret_arr;
43455 }
43456
43457 uint64_t  __attribute__((export_name("TS_BlindedRoute_read"))) TS_BlindedRoute_read(int8_tArray ser) {
43458         LDKu8slice ser_ref;
43459         ser_ref.datalen = ser->arr_len;
43460         ser_ref.data = ser->elems;
43461         LDKCResult_BlindedRouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedRouteDecodeErrorZ), "LDKCResult_BlindedRouteDecodeErrorZ");
43462         *ret_conv = BlindedRoute_read(ser_ref);
43463         FREE(ser);
43464         return tag_ptr(ret_conv, true);
43465 }
43466
43467 int8_tArray  __attribute__((export_name("TS_BlindedHop_write"))) TS_BlindedHop_write(uint64_t obj) {
43468         LDKBlindedHop obj_conv;
43469         obj_conv.inner = untag_ptr(obj);
43470         obj_conv.is_owned = ptr_is_owned(obj);
43471         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43472         obj_conv.is_owned = false;
43473         LDKCVec_u8Z ret_var = BlindedHop_write(&obj_conv);
43474         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43475         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43476         CVec_u8Z_free(ret_var);
43477         return ret_arr;
43478 }
43479
43480 uint64_t  __attribute__((export_name("TS_BlindedHop_read"))) TS_BlindedHop_read(int8_tArray ser) {
43481         LDKu8slice ser_ref;
43482         ser_ref.datalen = ser->arr_len;
43483         ser_ref.data = ser->elems;
43484         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
43485         *ret_conv = BlindedHop_read(ser_ref);
43486         FREE(ser);
43487         return tag_ptr(ret_conv, true);
43488 }
43489
43490 void  __attribute__((export_name("TS_OnionMessenger_free"))) TS_OnionMessenger_free(uint64_t this_obj) {
43491         LDKOnionMessenger this_obj_conv;
43492         this_obj_conv.inner = untag_ptr(this_obj);
43493         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43495         OnionMessenger_free(this_obj_conv);
43496 }
43497
43498 void  __attribute__((export_name("TS_Destination_free"))) TS_Destination_free(uint64_t this_ptr) {
43499         if (!ptr_is_owned(this_ptr)) return;
43500         void* this_ptr_ptr = untag_ptr(this_ptr);
43501         CHECK_ACCESS(this_ptr_ptr);
43502         LDKDestination this_ptr_conv = *(LDKDestination*)(this_ptr_ptr);
43503         FREE(untag_ptr(this_ptr));
43504         Destination_free(this_ptr_conv);
43505 }
43506
43507 uint64_t  __attribute__((export_name("TS_Destination_node"))) TS_Destination_node(int8_tArray a) {
43508         LDKPublicKey a_ref;
43509         CHECK(a->arr_len == 33);
43510         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
43511         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
43512         *ret_copy = Destination_node(a_ref);
43513         uint64_t ret_ref = tag_ptr(ret_copy, true);
43514         return ret_ref;
43515 }
43516
43517 uint64_t  __attribute__((export_name("TS_Destination_blinded_route"))) TS_Destination_blinded_route(uint64_t a) {
43518         LDKBlindedRoute a_conv;
43519         a_conv.inner = untag_ptr(a);
43520         a_conv.is_owned = ptr_is_owned(a);
43521         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43522         // WARNING: we need a move here but no clone is available for LDKBlindedRoute
43523         
43524         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
43525         *ret_copy = Destination_blinded_route(a_conv);
43526         uint64_t ret_ref = tag_ptr(ret_copy, true);
43527         return ret_ref;
43528 }
43529
43530 void  __attribute__((export_name("TS_SendError_free"))) TS_SendError_free(uint64_t this_ptr) {
43531         if (!ptr_is_owned(this_ptr)) return;
43532         void* this_ptr_ptr = untag_ptr(this_ptr);
43533         CHECK_ACCESS(this_ptr_ptr);
43534         LDKSendError this_ptr_conv = *(LDKSendError*)(this_ptr_ptr);
43535         FREE(untag_ptr(this_ptr));
43536         SendError_free(this_ptr_conv);
43537 }
43538
43539 static inline uint64_t SendError_clone_ptr(LDKSendError *NONNULL_PTR arg) {
43540         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
43541         *ret_copy = SendError_clone(arg);
43542         uint64_t ret_ref = tag_ptr(ret_copy, true);
43543         return ret_ref;
43544 }
43545 int64_t  __attribute__((export_name("TS_SendError_clone_ptr"))) TS_SendError_clone_ptr(uint64_t arg) {
43546         LDKSendError* arg_conv = (LDKSendError*)untag_ptr(arg);
43547         int64_t ret_conv = SendError_clone_ptr(arg_conv);
43548         return ret_conv;
43549 }
43550
43551 uint64_t  __attribute__((export_name("TS_SendError_clone"))) TS_SendError_clone(uint64_t orig) {
43552         LDKSendError* orig_conv = (LDKSendError*)untag_ptr(orig);
43553         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
43554         *ret_copy = SendError_clone(orig_conv);
43555         uint64_t ret_ref = tag_ptr(ret_copy, true);
43556         return ret_ref;
43557 }
43558
43559 uint64_t  __attribute__((export_name("TS_SendError_secp256k1"))) TS_SendError_secp256k1(uint32_t a) {
43560         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_js(a);
43561         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
43562         *ret_copy = SendError_secp256k1(a_conv);
43563         uint64_t ret_ref = tag_ptr(ret_copy, true);
43564         return ret_ref;
43565 }
43566
43567 uint64_t  __attribute__((export_name("TS_SendError_too_big_packet"))) TS_SendError_too_big_packet() {
43568         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
43569         *ret_copy = SendError_too_big_packet();
43570         uint64_t ret_ref = tag_ptr(ret_copy, true);
43571         return ret_ref;
43572 }
43573
43574 uint64_t  __attribute__((export_name("TS_SendError_too_few_blinded_hops"))) TS_SendError_too_few_blinded_hops() {
43575         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
43576         *ret_copy = SendError_too_few_blinded_hops();
43577         uint64_t ret_ref = tag_ptr(ret_copy, true);
43578         return ret_ref;
43579 }
43580
43581 uint64_t  __attribute__((export_name("TS_SendError_invalid_first_hop"))) TS_SendError_invalid_first_hop() {
43582         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
43583         *ret_copy = SendError_invalid_first_hop();
43584         uint64_t ret_ref = tag_ptr(ret_copy, true);
43585         return ret_ref;
43586 }
43587
43588 uint64_t  __attribute__((export_name("TS_SendError_buffer_full"))) TS_SendError_buffer_full() {
43589         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
43590         *ret_copy = SendError_buffer_full();
43591         uint64_t ret_ref = tag_ptr(ret_copy, true);
43592         return ret_ref;
43593 }
43594
43595 uint64_t  __attribute__((export_name("TS_OnionMessenger_new"))) TS_OnionMessenger_new(uint64_t keys_manager, uint64_t logger) {
43596         void* keys_manager_ptr = untag_ptr(keys_manager);
43597         CHECK_ACCESS(keys_manager_ptr);
43598         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
43599         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
43600                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43601                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
43602         }
43603         void* logger_ptr = untag_ptr(logger);
43604         CHECK_ACCESS(logger_ptr);
43605         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
43606         if (logger_conv.free == LDKLogger_JCalls_free) {
43607                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43608                 LDKLogger_JCalls_cloned(&logger_conv);
43609         }
43610         LDKOnionMessenger ret_var = OnionMessenger_new(keys_manager_conv, logger_conv);
43611         uint64_t ret_ref = 0;
43612         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43613         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43614         return ret_ref;
43615 }
43616
43617 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) {
43618         LDKOnionMessenger this_arg_conv;
43619         this_arg_conv.inner = untag_ptr(this_arg);
43620         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43622         this_arg_conv.is_owned = false;
43623         LDKCVec_PublicKeyZ intermediate_nodes_constr;
43624         intermediate_nodes_constr.datalen = intermediate_nodes->arr_len;
43625         if (intermediate_nodes_constr.datalen > 0)
43626                 intermediate_nodes_constr.data = MALLOC(intermediate_nodes_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
43627         else
43628                 intermediate_nodes_constr.data = NULL;
43629         int8_tArray* intermediate_nodes_vals = (void*) intermediate_nodes->elems;
43630         for (size_t m = 0; m < intermediate_nodes_constr.datalen; m++) {
43631                 int8_tArray intermediate_nodes_conv_12 = intermediate_nodes_vals[m];
43632                 LDKPublicKey intermediate_nodes_conv_12_ref;
43633                 CHECK(intermediate_nodes_conv_12->arr_len == 33);
43634                 memcpy(intermediate_nodes_conv_12_ref.compressed_form, intermediate_nodes_conv_12->elems, 33); FREE(intermediate_nodes_conv_12);
43635                 intermediate_nodes_constr.data[m] = intermediate_nodes_conv_12_ref;
43636         }
43637         FREE(intermediate_nodes);
43638         void* destination_ptr = untag_ptr(destination);
43639         CHECK_ACCESS(destination_ptr);
43640         LDKDestination destination_conv = *(LDKDestination*)(destination_ptr);
43641         // WARNING: we may need a move here but no clone is available for LDKDestination
43642         LDKBlindedRoute reply_path_conv;
43643         reply_path_conv.inner = untag_ptr(reply_path);
43644         reply_path_conv.is_owned = ptr_is_owned(reply_path);
43645         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
43646         reply_path_conv.is_owned = false;
43647         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
43648         *ret_conv = OnionMessenger_send_onion_message(&this_arg_conv, intermediate_nodes_constr, destination_conv, reply_path_conv);
43649         return tag_ptr(ret_conv, true);
43650 }
43651
43652 uint64_t  __attribute__((export_name("TS_OnionMessenger_as_OnionMessageHandler"))) TS_OnionMessenger_as_OnionMessageHandler(uint64_t this_arg) {
43653         LDKOnionMessenger this_arg_conv;
43654         this_arg_conv.inner = untag_ptr(this_arg);
43655         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43657         this_arg_conv.is_owned = false;
43658         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
43659         *ret_ret = OnionMessenger_as_OnionMessageHandler(&this_arg_conv);
43660         return tag_ptr(ret_ret, true);
43661 }
43662
43663 uint64_t  __attribute__((export_name("TS_OnionMessenger_as_OnionMessageProvider"))) TS_OnionMessenger_as_OnionMessageProvider(uint64_t this_arg) {
43664         LDKOnionMessenger this_arg_conv;
43665         this_arg_conv.inner = untag_ptr(this_arg);
43666         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43668         this_arg_conv.is_owned = false;
43669         LDKOnionMessageProvider* ret_ret = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
43670         *ret_ret = OnionMessenger_as_OnionMessageProvider(&this_arg_conv);
43671         return tag_ptr(ret_ret, true);
43672 }
43673
43674 void  __attribute__((export_name("TS_RapidGossipSync_free"))) TS_RapidGossipSync_free(uint64_t this_obj) {
43675         LDKRapidGossipSync this_obj_conv;
43676         this_obj_conv.inner = untag_ptr(this_obj);
43677         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43679         RapidGossipSync_free(this_obj_conv);
43680 }
43681
43682 uint64_t  __attribute__((export_name("TS_RapidGossipSync_new"))) TS_RapidGossipSync_new(uint64_t network_graph) {
43683         LDKNetworkGraph network_graph_conv;
43684         network_graph_conv.inner = untag_ptr(network_graph);
43685         network_graph_conv.is_owned = ptr_is_owned(network_graph);
43686         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
43687         network_graph_conv.is_owned = false;
43688         LDKRapidGossipSync ret_var = RapidGossipSync_new(&network_graph_conv);
43689         uint64_t ret_ref = 0;
43690         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43691         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43692         return ret_ref;
43693 }
43694
43695 uint64_t  __attribute__((export_name("TS_RapidGossipSync_update_network_graph"))) TS_RapidGossipSync_update_network_graph(uint64_t this_arg, int8_tArray update_data) {
43696         LDKRapidGossipSync this_arg_conv;
43697         this_arg_conv.inner = untag_ptr(this_arg);
43698         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43700         this_arg_conv.is_owned = false;
43701         LDKu8slice update_data_ref;
43702         update_data_ref.datalen = update_data->arr_len;
43703         update_data_ref.data = update_data->elems;
43704         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
43705         *ret_conv = RapidGossipSync_update_network_graph(&this_arg_conv, update_data_ref);
43706         FREE(update_data);
43707         return tag_ptr(ret_conv, true);
43708 }
43709
43710 jboolean  __attribute__((export_name("TS_RapidGossipSync_is_initial_sync_complete"))) TS_RapidGossipSync_is_initial_sync_complete(uint64_t this_arg) {
43711         LDKRapidGossipSync this_arg_conv;
43712         this_arg_conv.inner = untag_ptr(this_arg);
43713         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43715         this_arg_conv.is_owned = false;
43716         jboolean ret_conv = RapidGossipSync_is_initial_sync_complete(&this_arg_conv);
43717         return ret_conv;
43718 }
43719
43720 void  __attribute__((export_name("TS_GraphSyncError_free"))) TS_GraphSyncError_free(uint64_t this_ptr) {
43721         if (!ptr_is_owned(this_ptr)) return;
43722         void* this_ptr_ptr = untag_ptr(this_ptr);
43723         CHECK_ACCESS(this_ptr_ptr);
43724         LDKGraphSyncError this_ptr_conv = *(LDKGraphSyncError*)(this_ptr_ptr);
43725         FREE(untag_ptr(this_ptr));
43726         GraphSyncError_free(this_ptr_conv);
43727 }
43728
43729 static inline uint64_t GraphSyncError_clone_ptr(LDKGraphSyncError *NONNULL_PTR arg) {
43730         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
43731         *ret_copy = GraphSyncError_clone(arg);
43732         uint64_t ret_ref = tag_ptr(ret_copy, true);
43733         return ret_ref;
43734 }
43735 int64_t  __attribute__((export_name("TS_GraphSyncError_clone_ptr"))) TS_GraphSyncError_clone_ptr(uint64_t arg) {
43736         LDKGraphSyncError* arg_conv = (LDKGraphSyncError*)untag_ptr(arg);
43737         int64_t ret_conv = GraphSyncError_clone_ptr(arg_conv);
43738         return ret_conv;
43739 }
43740
43741 uint64_t  __attribute__((export_name("TS_GraphSyncError_clone"))) TS_GraphSyncError_clone(uint64_t orig) {
43742         LDKGraphSyncError* orig_conv = (LDKGraphSyncError*)untag_ptr(orig);
43743         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
43744         *ret_copy = GraphSyncError_clone(orig_conv);
43745         uint64_t ret_ref = tag_ptr(ret_copy, true);
43746         return ret_ref;
43747 }
43748
43749 uint64_t  __attribute__((export_name("TS_GraphSyncError_decode_error"))) TS_GraphSyncError_decode_error(uint64_t a) {
43750         LDKDecodeError a_conv;
43751         a_conv.inner = untag_ptr(a);
43752         a_conv.is_owned = ptr_is_owned(a);
43753         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43754         a_conv = DecodeError_clone(&a_conv);
43755         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
43756         *ret_copy = GraphSyncError_decode_error(a_conv);
43757         uint64_t ret_ref = tag_ptr(ret_copy, true);
43758         return ret_ref;
43759 }
43760
43761 uint64_t  __attribute__((export_name("TS_GraphSyncError_lightning_error"))) TS_GraphSyncError_lightning_error(uint64_t a) {
43762         LDKLightningError a_conv;
43763         a_conv.inner = untag_ptr(a);
43764         a_conv.is_owned = ptr_is_owned(a);
43765         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43766         a_conv = LightningError_clone(&a_conv);
43767         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
43768         *ret_copy = GraphSyncError_lightning_error(a_conv);
43769         uint64_t ret_ref = tag_ptr(ret_copy, true);
43770         return ret_ref;
43771 }
43772
43773 void  __attribute__((export_name("TS_ParseError_free"))) TS_ParseError_free(uint64_t this_ptr) {
43774         if (!ptr_is_owned(this_ptr)) return;
43775         void* this_ptr_ptr = untag_ptr(this_ptr);
43776         CHECK_ACCESS(this_ptr_ptr);
43777         LDKParseError this_ptr_conv = *(LDKParseError*)(this_ptr_ptr);
43778         FREE(untag_ptr(this_ptr));
43779         ParseError_free(this_ptr_conv);
43780 }
43781
43782 static inline uint64_t ParseError_clone_ptr(LDKParseError *NONNULL_PTR arg) {
43783         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43784         *ret_copy = ParseError_clone(arg);
43785         uint64_t ret_ref = tag_ptr(ret_copy, true);
43786         return ret_ref;
43787 }
43788 int64_t  __attribute__((export_name("TS_ParseError_clone_ptr"))) TS_ParseError_clone_ptr(uint64_t arg) {
43789         LDKParseError* arg_conv = (LDKParseError*)untag_ptr(arg);
43790         int64_t ret_conv = ParseError_clone_ptr(arg_conv);
43791         return ret_conv;
43792 }
43793
43794 uint64_t  __attribute__((export_name("TS_ParseError_clone"))) TS_ParseError_clone(uint64_t orig) {
43795         LDKParseError* orig_conv = (LDKParseError*)untag_ptr(orig);
43796         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43797         *ret_copy = ParseError_clone(orig_conv);
43798         uint64_t ret_ref = tag_ptr(ret_copy, true);
43799         return ret_ref;
43800 }
43801
43802 uint64_t  __attribute__((export_name("TS_ParseError_bech32_error"))) TS_ParseError_bech32_error(uint64_t a) {
43803         void* a_ptr = untag_ptr(a);
43804         CHECK_ACCESS(a_ptr);
43805         LDKBech32Error a_conv = *(LDKBech32Error*)(a_ptr);
43806         a_conv = Bech32Error_clone((LDKBech32Error*)untag_ptr(a));
43807         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43808         *ret_copy = ParseError_bech32_error(a_conv);
43809         uint64_t ret_ref = tag_ptr(ret_copy, true);
43810         return ret_ref;
43811 }
43812
43813 uint64_t  __attribute__((export_name("TS_ParseError_parse_amount_error"))) TS_ParseError_parse_amount_error(int32_t a) {
43814         
43815         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43816         *ret_copy = ParseError_parse_amount_error((LDKError){ ._dummy = 0 });
43817         uint64_t ret_ref = tag_ptr(ret_copy, true);
43818         return ret_ref;
43819 }
43820
43821 uint64_t  __attribute__((export_name("TS_ParseError_malformed_signature"))) TS_ParseError_malformed_signature(uint32_t a) {
43822         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_js(a);
43823         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43824         *ret_copy = ParseError_malformed_signature(a_conv);
43825         uint64_t ret_ref = tag_ptr(ret_copy, true);
43826         return ret_ref;
43827 }
43828
43829 uint64_t  __attribute__((export_name("TS_ParseError_bad_prefix"))) TS_ParseError_bad_prefix() {
43830         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43831         *ret_copy = ParseError_bad_prefix();
43832         uint64_t ret_ref = tag_ptr(ret_copy, true);
43833         return ret_ref;
43834 }
43835
43836 uint64_t  __attribute__((export_name("TS_ParseError_unknown_currency"))) TS_ParseError_unknown_currency() {
43837         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43838         *ret_copy = ParseError_unknown_currency();
43839         uint64_t ret_ref = tag_ptr(ret_copy, true);
43840         return ret_ref;
43841 }
43842
43843 uint64_t  __attribute__((export_name("TS_ParseError_unknown_si_prefix"))) TS_ParseError_unknown_si_prefix() {
43844         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43845         *ret_copy = ParseError_unknown_si_prefix();
43846         uint64_t ret_ref = tag_ptr(ret_copy, true);
43847         return ret_ref;
43848 }
43849
43850 uint64_t  __attribute__((export_name("TS_ParseError_malformed_hrp"))) TS_ParseError_malformed_hrp() {
43851         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43852         *ret_copy = ParseError_malformed_hrp();
43853         uint64_t ret_ref = tag_ptr(ret_copy, true);
43854         return ret_ref;
43855 }
43856
43857 uint64_t  __attribute__((export_name("TS_ParseError_too_short_data_part"))) TS_ParseError_too_short_data_part() {
43858         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43859         *ret_copy = ParseError_too_short_data_part();
43860         uint64_t ret_ref = tag_ptr(ret_copy, true);
43861         return ret_ref;
43862 }
43863
43864 uint64_t  __attribute__((export_name("TS_ParseError_unexpected_end_of_tagged_fields"))) TS_ParseError_unexpected_end_of_tagged_fields() {
43865         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43866         *ret_copy = ParseError_unexpected_end_of_tagged_fields();
43867         uint64_t ret_ref = tag_ptr(ret_copy, true);
43868         return ret_ref;
43869 }
43870
43871 uint64_t  __attribute__((export_name("TS_ParseError_description_decode_error"))) TS_ParseError_description_decode_error(int32_t a) {
43872         
43873         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43874         *ret_copy = ParseError_description_decode_error((LDKError){ ._dummy = 0 });
43875         uint64_t ret_ref = tag_ptr(ret_copy, true);
43876         return ret_ref;
43877 }
43878
43879 uint64_t  __attribute__((export_name("TS_ParseError_padding_error"))) TS_ParseError_padding_error() {
43880         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43881         *ret_copy = ParseError_padding_error();
43882         uint64_t ret_ref = tag_ptr(ret_copy, true);
43883         return ret_ref;
43884 }
43885
43886 uint64_t  __attribute__((export_name("TS_ParseError_integer_overflow_error"))) TS_ParseError_integer_overflow_error() {
43887         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43888         *ret_copy = ParseError_integer_overflow_error();
43889         uint64_t ret_ref = tag_ptr(ret_copy, true);
43890         return ret_ref;
43891 }
43892
43893 uint64_t  __attribute__((export_name("TS_ParseError_invalid_seg_wit_program_length"))) TS_ParseError_invalid_seg_wit_program_length() {
43894         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43895         *ret_copy = ParseError_invalid_seg_wit_program_length();
43896         uint64_t ret_ref = tag_ptr(ret_copy, true);
43897         return ret_ref;
43898 }
43899
43900 uint64_t  __attribute__((export_name("TS_ParseError_invalid_pub_key_hash_length"))) TS_ParseError_invalid_pub_key_hash_length() {
43901         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43902         *ret_copy = ParseError_invalid_pub_key_hash_length();
43903         uint64_t ret_ref = tag_ptr(ret_copy, true);
43904         return ret_ref;
43905 }
43906
43907 uint64_t  __attribute__((export_name("TS_ParseError_invalid_script_hash_length"))) TS_ParseError_invalid_script_hash_length() {
43908         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43909         *ret_copy = ParseError_invalid_script_hash_length();
43910         uint64_t ret_ref = tag_ptr(ret_copy, true);
43911         return ret_ref;
43912 }
43913
43914 uint64_t  __attribute__((export_name("TS_ParseError_invalid_recovery_id"))) TS_ParseError_invalid_recovery_id() {
43915         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43916         *ret_copy = ParseError_invalid_recovery_id();
43917         uint64_t ret_ref = tag_ptr(ret_copy, true);
43918         return ret_ref;
43919 }
43920
43921 uint64_t  __attribute__((export_name("TS_ParseError_invalid_slice_length"))) TS_ParseError_invalid_slice_length(jstring a) {
43922         LDKStr a_conv = str_ref_to_owned_c(a);
43923         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43924         *ret_copy = ParseError_invalid_slice_length(a_conv);
43925         uint64_t ret_ref = tag_ptr(ret_copy, true);
43926         return ret_ref;
43927 }
43928
43929 uint64_t  __attribute__((export_name("TS_ParseError_skip"))) TS_ParseError_skip() {
43930         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43931         *ret_copy = ParseError_skip();
43932         uint64_t ret_ref = tag_ptr(ret_copy, true);
43933         return ret_ref;
43934 }
43935
43936 void  __attribute__((export_name("TS_ParseOrSemanticError_free"))) TS_ParseOrSemanticError_free(uint64_t this_ptr) {
43937         if (!ptr_is_owned(this_ptr)) return;
43938         void* this_ptr_ptr = untag_ptr(this_ptr);
43939         CHECK_ACCESS(this_ptr_ptr);
43940         LDKParseOrSemanticError this_ptr_conv = *(LDKParseOrSemanticError*)(this_ptr_ptr);
43941         FREE(untag_ptr(this_ptr));
43942         ParseOrSemanticError_free(this_ptr_conv);
43943 }
43944
43945 static inline uint64_t ParseOrSemanticError_clone_ptr(LDKParseOrSemanticError *NONNULL_PTR arg) {
43946         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
43947         *ret_copy = ParseOrSemanticError_clone(arg);
43948         uint64_t ret_ref = tag_ptr(ret_copy, true);
43949         return ret_ref;
43950 }
43951 int64_t  __attribute__((export_name("TS_ParseOrSemanticError_clone_ptr"))) TS_ParseOrSemanticError_clone_ptr(uint64_t arg) {
43952         LDKParseOrSemanticError* arg_conv = (LDKParseOrSemanticError*)untag_ptr(arg);
43953         int64_t ret_conv = ParseOrSemanticError_clone_ptr(arg_conv);
43954         return ret_conv;
43955 }
43956
43957 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_clone"))) TS_ParseOrSemanticError_clone(uint64_t orig) {
43958         LDKParseOrSemanticError* orig_conv = (LDKParseOrSemanticError*)untag_ptr(orig);
43959         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
43960         *ret_copy = ParseOrSemanticError_clone(orig_conv);
43961         uint64_t ret_ref = tag_ptr(ret_copy, true);
43962         return ret_ref;
43963 }
43964
43965 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_parse_error"))) TS_ParseOrSemanticError_parse_error(uint64_t a) {
43966         void* a_ptr = untag_ptr(a);
43967         CHECK_ACCESS(a_ptr);
43968         LDKParseError a_conv = *(LDKParseError*)(a_ptr);
43969         a_conv = ParseError_clone((LDKParseError*)untag_ptr(a));
43970         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
43971         *ret_copy = ParseOrSemanticError_parse_error(a_conv);
43972         uint64_t ret_ref = tag_ptr(ret_copy, true);
43973         return ret_ref;
43974 }
43975
43976 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_semantic_error"))) TS_ParseOrSemanticError_semantic_error(uint32_t a) {
43977         LDKSemanticError a_conv = LDKSemanticError_from_js(a);
43978         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
43979         *ret_copy = ParseOrSemanticError_semantic_error(a_conv);
43980         uint64_t ret_ref = tag_ptr(ret_copy, true);
43981         return ret_ref;
43982 }
43983
43984 void  __attribute__((export_name("TS_Invoice_free"))) TS_Invoice_free(uint64_t this_obj) {
43985         LDKInvoice this_obj_conv;
43986         this_obj_conv.inner = untag_ptr(this_obj);
43987         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43989         Invoice_free(this_obj_conv);
43990 }
43991
43992 jboolean  __attribute__((export_name("TS_Invoice_eq"))) TS_Invoice_eq(uint64_t a, uint64_t b) {
43993         LDKInvoice a_conv;
43994         a_conv.inner = untag_ptr(a);
43995         a_conv.is_owned = ptr_is_owned(a);
43996         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43997         a_conv.is_owned = false;
43998         LDKInvoice b_conv;
43999         b_conv.inner = untag_ptr(b);
44000         b_conv.is_owned = ptr_is_owned(b);
44001         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44002         b_conv.is_owned = false;
44003         jboolean ret_conv = Invoice_eq(&a_conv, &b_conv);
44004         return ret_conv;
44005 }
44006
44007 static inline uint64_t Invoice_clone_ptr(LDKInvoice *NONNULL_PTR arg) {
44008         LDKInvoice ret_var = Invoice_clone(arg);
44009         uint64_t ret_ref = 0;
44010         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44011         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44012         return ret_ref;
44013 }
44014 int64_t  __attribute__((export_name("TS_Invoice_clone_ptr"))) TS_Invoice_clone_ptr(uint64_t arg) {
44015         LDKInvoice arg_conv;
44016         arg_conv.inner = untag_ptr(arg);
44017         arg_conv.is_owned = ptr_is_owned(arg);
44018         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44019         arg_conv.is_owned = false;
44020         int64_t ret_conv = Invoice_clone_ptr(&arg_conv);
44021         return ret_conv;
44022 }
44023
44024 uint64_t  __attribute__((export_name("TS_Invoice_clone"))) TS_Invoice_clone(uint64_t orig) {
44025         LDKInvoice orig_conv;
44026         orig_conv.inner = untag_ptr(orig);
44027         orig_conv.is_owned = ptr_is_owned(orig);
44028         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44029         orig_conv.is_owned = false;
44030         LDKInvoice ret_var = Invoice_clone(&orig_conv);
44031         uint64_t ret_ref = 0;
44032         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44033         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44034         return ret_ref;
44035 }
44036
44037 int64_t  __attribute__((export_name("TS_Invoice_hash"))) TS_Invoice_hash(uint64_t o) {
44038         LDKInvoice o_conv;
44039         o_conv.inner = untag_ptr(o);
44040         o_conv.is_owned = ptr_is_owned(o);
44041         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44042         o_conv.is_owned = false;
44043         int64_t ret_conv = Invoice_hash(&o_conv);
44044         return ret_conv;
44045 }
44046
44047 void  __attribute__((export_name("TS_SignedRawInvoice_free"))) TS_SignedRawInvoice_free(uint64_t this_obj) {
44048         LDKSignedRawInvoice this_obj_conv;
44049         this_obj_conv.inner = untag_ptr(this_obj);
44050         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44052         SignedRawInvoice_free(this_obj_conv);
44053 }
44054
44055 jboolean  __attribute__((export_name("TS_SignedRawInvoice_eq"))) TS_SignedRawInvoice_eq(uint64_t a, uint64_t b) {
44056         LDKSignedRawInvoice a_conv;
44057         a_conv.inner = untag_ptr(a);
44058         a_conv.is_owned = ptr_is_owned(a);
44059         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44060         a_conv.is_owned = false;
44061         LDKSignedRawInvoice b_conv;
44062         b_conv.inner = untag_ptr(b);
44063         b_conv.is_owned = ptr_is_owned(b);
44064         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44065         b_conv.is_owned = false;
44066         jboolean ret_conv = SignedRawInvoice_eq(&a_conv, &b_conv);
44067         return ret_conv;
44068 }
44069
44070 static inline uint64_t SignedRawInvoice_clone_ptr(LDKSignedRawInvoice *NONNULL_PTR arg) {
44071         LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(arg);
44072         uint64_t ret_ref = 0;
44073         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44074         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44075         return ret_ref;
44076 }
44077 int64_t  __attribute__((export_name("TS_SignedRawInvoice_clone_ptr"))) TS_SignedRawInvoice_clone_ptr(uint64_t arg) {
44078         LDKSignedRawInvoice arg_conv;
44079         arg_conv.inner = untag_ptr(arg);
44080         arg_conv.is_owned = ptr_is_owned(arg);
44081         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44082         arg_conv.is_owned = false;
44083         int64_t ret_conv = SignedRawInvoice_clone_ptr(&arg_conv);
44084         return ret_conv;
44085 }
44086
44087 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_clone"))) TS_SignedRawInvoice_clone(uint64_t orig) {
44088         LDKSignedRawInvoice orig_conv;
44089         orig_conv.inner = untag_ptr(orig);
44090         orig_conv.is_owned = ptr_is_owned(orig);
44091         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44092         orig_conv.is_owned = false;
44093         LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(&orig_conv);
44094         uint64_t ret_ref = 0;
44095         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44096         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44097         return ret_ref;
44098 }
44099
44100 int64_t  __attribute__((export_name("TS_SignedRawInvoice_hash"))) TS_SignedRawInvoice_hash(uint64_t o) {
44101         LDKSignedRawInvoice o_conv;
44102         o_conv.inner = untag_ptr(o);
44103         o_conv.is_owned = ptr_is_owned(o);
44104         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44105         o_conv.is_owned = false;
44106         int64_t ret_conv = SignedRawInvoice_hash(&o_conv);
44107         return ret_conv;
44108 }
44109
44110 void  __attribute__((export_name("TS_RawInvoice_free"))) TS_RawInvoice_free(uint64_t this_obj) {
44111         LDKRawInvoice this_obj_conv;
44112         this_obj_conv.inner = untag_ptr(this_obj);
44113         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44115         RawInvoice_free(this_obj_conv);
44116 }
44117
44118 uint64_t  __attribute__((export_name("TS_RawInvoice_get_data"))) TS_RawInvoice_get_data(uint64_t this_ptr) {
44119         LDKRawInvoice this_ptr_conv;
44120         this_ptr_conv.inner = untag_ptr(this_ptr);
44121         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44122         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44123         this_ptr_conv.is_owned = false;
44124         LDKRawDataPart ret_var = RawInvoice_get_data(&this_ptr_conv);
44125         uint64_t ret_ref = 0;
44126         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44127         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44128         return ret_ref;
44129 }
44130
44131 void  __attribute__((export_name("TS_RawInvoice_set_data"))) TS_RawInvoice_set_data(uint64_t this_ptr, uint64_t val) {
44132         LDKRawInvoice this_ptr_conv;
44133         this_ptr_conv.inner = untag_ptr(this_ptr);
44134         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44135         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44136         this_ptr_conv.is_owned = false;
44137         LDKRawDataPart val_conv;
44138         val_conv.inner = untag_ptr(val);
44139         val_conv.is_owned = ptr_is_owned(val);
44140         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44141         val_conv = RawDataPart_clone(&val_conv);
44142         RawInvoice_set_data(&this_ptr_conv, val_conv);
44143 }
44144
44145 jboolean  __attribute__((export_name("TS_RawInvoice_eq"))) TS_RawInvoice_eq(uint64_t a, uint64_t b) {
44146         LDKRawInvoice a_conv;
44147         a_conv.inner = untag_ptr(a);
44148         a_conv.is_owned = ptr_is_owned(a);
44149         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44150         a_conv.is_owned = false;
44151         LDKRawInvoice b_conv;
44152         b_conv.inner = untag_ptr(b);
44153         b_conv.is_owned = ptr_is_owned(b);
44154         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44155         b_conv.is_owned = false;
44156         jboolean ret_conv = RawInvoice_eq(&a_conv, &b_conv);
44157         return ret_conv;
44158 }
44159
44160 static inline uint64_t RawInvoice_clone_ptr(LDKRawInvoice *NONNULL_PTR arg) {
44161         LDKRawInvoice ret_var = RawInvoice_clone(arg);
44162         uint64_t ret_ref = 0;
44163         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44164         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44165         return ret_ref;
44166 }
44167 int64_t  __attribute__((export_name("TS_RawInvoice_clone_ptr"))) TS_RawInvoice_clone_ptr(uint64_t arg) {
44168         LDKRawInvoice arg_conv;
44169         arg_conv.inner = untag_ptr(arg);
44170         arg_conv.is_owned = ptr_is_owned(arg);
44171         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44172         arg_conv.is_owned = false;
44173         int64_t ret_conv = RawInvoice_clone_ptr(&arg_conv);
44174         return ret_conv;
44175 }
44176
44177 uint64_t  __attribute__((export_name("TS_RawInvoice_clone"))) TS_RawInvoice_clone(uint64_t orig) {
44178         LDKRawInvoice orig_conv;
44179         orig_conv.inner = untag_ptr(orig);
44180         orig_conv.is_owned = ptr_is_owned(orig);
44181         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44182         orig_conv.is_owned = false;
44183         LDKRawInvoice ret_var = RawInvoice_clone(&orig_conv);
44184         uint64_t ret_ref = 0;
44185         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44186         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44187         return ret_ref;
44188 }
44189
44190 int64_t  __attribute__((export_name("TS_RawInvoice_hash"))) TS_RawInvoice_hash(uint64_t o) {
44191         LDKRawInvoice o_conv;
44192         o_conv.inner = untag_ptr(o);
44193         o_conv.is_owned = ptr_is_owned(o);
44194         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44195         o_conv.is_owned = false;
44196         int64_t ret_conv = RawInvoice_hash(&o_conv);
44197         return ret_conv;
44198 }
44199
44200 void  __attribute__((export_name("TS_RawDataPart_free"))) TS_RawDataPart_free(uint64_t this_obj) {
44201         LDKRawDataPart this_obj_conv;
44202         this_obj_conv.inner = untag_ptr(this_obj);
44203         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44204         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44205         RawDataPart_free(this_obj_conv);
44206 }
44207
44208 uint64_t  __attribute__((export_name("TS_RawDataPart_get_timestamp"))) TS_RawDataPart_get_timestamp(uint64_t this_ptr) {
44209         LDKRawDataPart this_ptr_conv;
44210         this_ptr_conv.inner = untag_ptr(this_ptr);
44211         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44213         this_ptr_conv.is_owned = false;
44214         LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
44215         uint64_t ret_ref = 0;
44216         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44217         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44218         return ret_ref;
44219 }
44220
44221 void  __attribute__((export_name("TS_RawDataPart_set_timestamp"))) TS_RawDataPart_set_timestamp(uint64_t this_ptr, uint64_t val) {
44222         LDKRawDataPart this_ptr_conv;
44223         this_ptr_conv.inner = untag_ptr(this_ptr);
44224         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44226         this_ptr_conv.is_owned = false;
44227         LDKPositiveTimestamp val_conv;
44228         val_conv.inner = untag_ptr(val);
44229         val_conv.is_owned = ptr_is_owned(val);
44230         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44231         val_conv = PositiveTimestamp_clone(&val_conv);
44232         RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
44233 }
44234
44235 jboolean  __attribute__((export_name("TS_RawDataPart_eq"))) TS_RawDataPart_eq(uint64_t a, uint64_t b) {
44236         LDKRawDataPart a_conv;
44237         a_conv.inner = untag_ptr(a);
44238         a_conv.is_owned = ptr_is_owned(a);
44239         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44240         a_conv.is_owned = false;
44241         LDKRawDataPart b_conv;
44242         b_conv.inner = untag_ptr(b);
44243         b_conv.is_owned = ptr_is_owned(b);
44244         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44245         b_conv.is_owned = false;
44246         jboolean ret_conv = RawDataPart_eq(&a_conv, &b_conv);
44247         return ret_conv;
44248 }
44249
44250 static inline uint64_t RawDataPart_clone_ptr(LDKRawDataPart *NONNULL_PTR arg) {
44251         LDKRawDataPart ret_var = RawDataPart_clone(arg);
44252         uint64_t ret_ref = 0;
44253         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44254         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44255         return ret_ref;
44256 }
44257 int64_t  __attribute__((export_name("TS_RawDataPart_clone_ptr"))) TS_RawDataPart_clone_ptr(uint64_t arg) {
44258         LDKRawDataPart arg_conv;
44259         arg_conv.inner = untag_ptr(arg);
44260         arg_conv.is_owned = ptr_is_owned(arg);
44261         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44262         arg_conv.is_owned = false;
44263         int64_t ret_conv = RawDataPart_clone_ptr(&arg_conv);
44264         return ret_conv;
44265 }
44266
44267 uint64_t  __attribute__((export_name("TS_RawDataPart_clone"))) TS_RawDataPart_clone(uint64_t orig) {
44268         LDKRawDataPart orig_conv;
44269         orig_conv.inner = untag_ptr(orig);
44270         orig_conv.is_owned = ptr_is_owned(orig);
44271         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44272         orig_conv.is_owned = false;
44273         LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
44274         uint64_t ret_ref = 0;
44275         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44276         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44277         return ret_ref;
44278 }
44279
44280 int64_t  __attribute__((export_name("TS_RawDataPart_hash"))) TS_RawDataPart_hash(uint64_t o) {
44281         LDKRawDataPart o_conv;
44282         o_conv.inner = untag_ptr(o);
44283         o_conv.is_owned = ptr_is_owned(o);
44284         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44285         o_conv.is_owned = false;
44286         int64_t ret_conv = RawDataPart_hash(&o_conv);
44287         return ret_conv;
44288 }
44289
44290 void  __attribute__((export_name("TS_PositiveTimestamp_free"))) TS_PositiveTimestamp_free(uint64_t this_obj) {
44291         LDKPositiveTimestamp this_obj_conv;
44292         this_obj_conv.inner = untag_ptr(this_obj);
44293         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44295         PositiveTimestamp_free(this_obj_conv);
44296 }
44297
44298 jboolean  __attribute__((export_name("TS_PositiveTimestamp_eq"))) TS_PositiveTimestamp_eq(uint64_t a, uint64_t b) {
44299         LDKPositiveTimestamp a_conv;
44300         a_conv.inner = untag_ptr(a);
44301         a_conv.is_owned = ptr_is_owned(a);
44302         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44303         a_conv.is_owned = false;
44304         LDKPositiveTimestamp b_conv;
44305         b_conv.inner = untag_ptr(b);
44306         b_conv.is_owned = ptr_is_owned(b);
44307         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44308         b_conv.is_owned = false;
44309         jboolean ret_conv = PositiveTimestamp_eq(&a_conv, &b_conv);
44310         return ret_conv;
44311 }
44312
44313 static inline uint64_t PositiveTimestamp_clone_ptr(LDKPositiveTimestamp *NONNULL_PTR arg) {
44314         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(arg);
44315         uint64_t ret_ref = 0;
44316         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44317         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44318         return ret_ref;
44319 }
44320 int64_t  __attribute__((export_name("TS_PositiveTimestamp_clone_ptr"))) TS_PositiveTimestamp_clone_ptr(uint64_t arg) {
44321         LDKPositiveTimestamp arg_conv;
44322         arg_conv.inner = untag_ptr(arg);
44323         arg_conv.is_owned = ptr_is_owned(arg);
44324         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44325         arg_conv.is_owned = false;
44326         int64_t ret_conv = PositiveTimestamp_clone_ptr(&arg_conv);
44327         return ret_conv;
44328 }
44329
44330 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_clone"))) TS_PositiveTimestamp_clone(uint64_t orig) {
44331         LDKPositiveTimestamp orig_conv;
44332         orig_conv.inner = untag_ptr(orig);
44333         orig_conv.is_owned = ptr_is_owned(orig);
44334         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44335         orig_conv.is_owned = false;
44336         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
44337         uint64_t ret_ref = 0;
44338         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44339         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44340         return ret_ref;
44341 }
44342
44343 int64_t  __attribute__((export_name("TS_PositiveTimestamp_hash"))) TS_PositiveTimestamp_hash(uint64_t o) {
44344         LDKPositiveTimestamp o_conv;
44345         o_conv.inner = untag_ptr(o);
44346         o_conv.is_owned = ptr_is_owned(o);
44347         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44348         o_conv.is_owned = false;
44349         int64_t ret_conv = PositiveTimestamp_hash(&o_conv);
44350         return ret_conv;
44351 }
44352
44353 uint32_t  __attribute__((export_name("TS_SiPrefix_clone"))) TS_SiPrefix_clone(uint64_t orig) {
44354         LDKSiPrefix* orig_conv = (LDKSiPrefix*)untag_ptr(orig);
44355         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_clone(orig_conv));
44356         return ret_conv;
44357 }
44358
44359 uint32_t  __attribute__((export_name("TS_SiPrefix_milli"))) TS_SiPrefix_milli() {
44360         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_milli());
44361         return ret_conv;
44362 }
44363
44364 uint32_t  __attribute__((export_name("TS_SiPrefix_micro"))) TS_SiPrefix_micro() {
44365         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_micro());
44366         return ret_conv;
44367 }
44368
44369 uint32_t  __attribute__((export_name("TS_SiPrefix_nano"))) TS_SiPrefix_nano() {
44370         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_nano());
44371         return ret_conv;
44372 }
44373
44374 uint32_t  __attribute__((export_name("TS_SiPrefix_pico"))) TS_SiPrefix_pico() {
44375         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_pico());
44376         return ret_conv;
44377 }
44378
44379 jboolean  __attribute__((export_name("TS_SiPrefix_eq"))) TS_SiPrefix_eq(uint64_t a, uint64_t b) {
44380         LDKSiPrefix* a_conv = (LDKSiPrefix*)untag_ptr(a);
44381         LDKSiPrefix* b_conv = (LDKSiPrefix*)untag_ptr(b);
44382         jboolean ret_conv = SiPrefix_eq(a_conv, b_conv);
44383         return ret_conv;
44384 }
44385
44386 int64_t  __attribute__((export_name("TS_SiPrefix_hash"))) TS_SiPrefix_hash(uint64_t o) {
44387         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
44388         int64_t ret_conv = SiPrefix_hash(o_conv);
44389         return ret_conv;
44390 }
44391
44392 int64_t  __attribute__((export_name("TS_SiPrefix_multiplier"))) TS_SiPrefix_multiplier(uint64_t this_arg) {
44393         LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)untag_ptr(this_arg);
44394         int64_t ret_conv = SiPrefix_multiplier(this_arg_conv);
44395         return ret_conv;
44396 }
44397
44398 uint32_t  __attribute__((export_name("TS_Currency_clone"))) TS_Currency_clone(uint64_t orig) {
44399         LDKCurrency* orig_conv = (LDKCurrency*)untag_ptr(orig);
44400         uint32_t ret_conv = LDKCurrency_to_js(Currency_clone(orig_conv));
44401         return ret_conv;
44402 }
44403
44404 uint32_t  __attribute__((export_name("TS_Currency_bitcoin"))) TS_Currency_bitcoin() {
44405         uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin());
44406         return ret_conv;
44407 }
44408
44409 uint32_t  __attribute__((export_name("TS_Currency_bitcoin_testnet"))) TS_Currency_bitcoin_testnet() {
44410         uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin_testnet());
44411         return ret_conv;
44412 }
44413
44414 uint32_t  __attribute__((export_name("TS_Currency_regtest"))) TS_Currency_regtest() {
44415         uint32_t ret_conv = LDKCurrency_to_js(Currency_regtest());
44416         return ret_conv;
44417 }
44418
44419 uint32_t  __attribute__((export_name("TS_Currency_simnet"))) TS_Currency_simnet() {
44420         uint32_t ret_conv = LDKCurrency_to_js(Currency_simnet());
44421         return ret_conv;
44422 }
44423
44424 uint32_t  __attribute__((export_name("TS_Currency_signet"))) TS_Currency_signet() {
44425         uint32_t ret_conv = LDKCurrency_to_js(Currency_signet());
44426         return ret_conv;
44427 }
44428
44429 int64_t  __attribute__((export_name("TS_Currency_hash"))) TS_Currency_hash(uint64_t o) {
44430         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
44431         int64_t ret_conv = Currency_hash(o_conv);
44432         return ret_conv;
44433 }
44434
44435 jboolean  __attribute__((export_name("TS_Currency_eq"))) TS_Currency_eq(uint64_t a, uint64_t b) {
44436         LDKCurrency* a_conv = (LDKCurrency*)untag_ptr(a);
44437         LDKCurrency* b_conv = (LDKCurrency*)untag_ptr(b);
44438         jboolean ret_conv = Currency_eq(a_conv, b_conv);
44439         return ret_conv;
44440 }
44441
44442 void  __attribute__((export_name("TS_Sha256_free"))) TS_Sha256_free(uint64_t this_obj) {
44443         LDKSha256 this_obj_conv;
44444         this_obj_conv.inner = untag_ptr(this_obj);
44445         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44447         Sha256_free(this_obj_conv);
44448 }
44449
44450 static inline uint64_t Sha256_clone_ptr(LDKSha256 *NONNULL_PTR arg) {
44451         LDKSha256 ret_var = Sha256_clone(arg);
44452         uint64_t ret_ref = 0;
44453         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44454         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44455         return ret_ref;
44456 }
44457 int64_t  __attribute__((export_name("TS_Sha256_clone_ptr"))) TS_Sha256_clone_ptr(uint64_t arg) {
44458         LDKSha256 arg_conv;
44459         arg_conv.inner = untag_ptr(arg);
44460         arg_conv.is_owned = ptr_is_owned(arg);
44461         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44462         arg_conv.is_owned = false;
44463         int64_t ret_conv = Sha256_clone_ptr(&arg_conv);
44464         return ret_conv;
44465 }
44466
44467 uint64_t  __attribute__((export_name("TS_Sha256_clone"))) TS_Sha256_clone(uint64_t orig) {
44468         LDKSha256 orig_conv;
44469         orig_conv.inner = untag_ptr(orig);
44470         orig_conv.is_owned = ptr_is_owned(orig);
44471         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44472         orig_conv.is_owned = false;
44473         LDKSha256 ret_var = Sha256_clone(&orig_conv);
44474         uint64_t ret_ref = 0;
44475         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44476         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44477         return ret_ref;
44478 }
44479
44480 int64_t  __attribute__((export_name("TS_Sha256_hash"))) TS_Sha256_hash(uint64_t o) {
44481         LDKSha256 o_conv;
44482         o_conv.inner = untag_ptr(o);
44483         o_conv.is_owned = ptr_is_owned(o);
44484         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44485         o_conv.is_owned = false;
44486         int64_t ret_conv = Sha256_hash(&o_conv);
44487         return ret_conv;
44488 }
44489
44490 jboolean  __attribute__((export_name("TS_Sha256_eq"))) TS_Sha256_eq(uint64_t a, uint64_t b) {
44491         LDKSha256 a_conv;
44492         a_conv.inner = untag_ptr(a);
44493         a_conv.is_owned = ptr_is_owned(a);
44494         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44495         a_conv.is_owned = false;
44496         LDKSha256 b_conv;
44497         b_conv.inner = untag_ptr(b);
44498         b_conv.is_owned = ptr_is_owned(b);
44499         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44500         b_conv.is_owned = false;
44501         jboolean ret_conv = Sha256_eq(&a_conv, &b_conv);
44502         return ret_conv;
44503 }
44504
44505 void  __attribute__((export_name("TS_Description_free"))) TS_Description_free(uint64_t this_obj) {
44506         LDKDescription this_obj_conv;
44507         this_obj_conv.inner = untag_ptr(this_obj);
44508         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44510         Description_free(this_obj_conv);
44511 }
44512
44513 static inline uint64_t Description_clone_ptr(LDKDescription *NONNULL_PTR arg) {
44514         LDKDescription ret_var = Description_clone(arg);
44515         uint64_t ret_ref = 0;
44516         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44517         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44518         return ret_ref;
44519 }
44520 int64_t  __attribute__((export_name("TS_Description_clone_ptr"))) TS_Description_clone_ptr(uint64_t arg) {
44521         LDKDescription arg_conv;
44522         arg_conv.inner = untag_ptr(arg);
44523         arg_conv.is_owned = ptr_is_owned(arg);
44524         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44525         arg_conv.is_owned = false;
44526         int64_t ret_conv = Description_clone_ptr(&arg_conv);
44527         return ret_conv;
44528 }
44529
44530 uint64_t  __attribute__((export_name("TS_Description_clone"))) TS_Description_clone(uint64_t orig) {
44531         LDKDescription orig_conv;
44532         orig_conv.inner = untag_ptr(orig);
44533         orig_conv.is_owned = ptr_is_owned(orig);
44534         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44535         orig_conv.is_owned = false;
44536         LDKDescription ret_var = Description_clone(&orig_conv);
44537         uint64_t ret_ref = 0;
44538         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44539         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44540         return ret_ref;
44541 }
44542
44543 int64_t  __attribute__((export_name("TS_Description_hash"))) TS_Description_hash(uint64_t o) {
44544         LDKDescription o_conv;
44545         o_conv.inner = untag_ptr(o);
44546         o_conv.is_owned = ptr_is_owned(o);
44547         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44548         o_conv.is_owned = false;
44549         int64_t ret_conv = Description_hash(&o_conv);
44550         return ret_conv;
44551 }
44552
44553 jboolean  __attribute__((export_name("TS_Description_eq"))) TS_Description_eq(uint64_t a, uint64_t b) {
44554         LDKDescription a_conv;
44555         a_conv.inner = untag_ptr(a);
44556         a_conv.is_owned = ptr_is_owned(a);
44557         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44558         a_conv.is_owned = false;
44559         LDKDescription b_conv;
44560         b_conv.inner = untag_ptr(b);
44561         b_conv.is_owned = ptr_is_owned(b);
44562         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44563         b_conv.is_owned = false;
44564         jboolean ret_conv = Description_eq(&a_conv, &b_conv);
44565         return ret_conv;
44566 }
44567
44568 void  __attribute__((export_name("TS_PayeePubKey_free"))) TS_PayeePubKey_free(uint64_t this_obj) {
44569         LDKPayeePubKey this_obj_conv;
44570         this_obj_conv.inner = untag_ptr(this_obj);
44571         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44573         PayeePubKey_free(this_obj_conv);
44574 }
44575
44576 int8_tArray  __attribute__((export_name("TS_PayeePubKey_get_a"))) TS_PayeePubKey_get_a(uint64_t this_ptr) {
44577         LDKPayeePubKey this_ptr_conv;
44578         this_ptr_conv.inner = untag_ptr(this_ptr);
44579         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44581         this_ptr_conv.is_owned = false;
44582         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44583         memcpy(ret_arr->elems, PayeePubKey_get_a(&this_ptr_conv).compressed_form, 33);
44584         return ret_arr;
44585 }
44586
44587 void  __attribute__((export_name("TS_PayeePubKey_set_a"))) TS_PayeePubKey_set_a(uint64_t this_ptr, int8_tArray val) {
44588         LDKPayeePubKey this_ptr_conv;
44589         this_ptr_conv.inner = untag_ptr(this_ptr);
44590         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44592         this_ptr_conv.is_owned = false;
44593         LDKPublicKey val_ref;
44594         CHECK(val->arr_len == 33);
44595         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
44596         PayeePubKey_set_a(&this_ptr_conv, val_ref);
44597 }
44598
44599 uint64_t  __attribute__((export_name("TS_PayeePubKey_new"))) TS_PayeePubKey_new(int8_tArray a_arg) {
44600         LDKPublicKey a_arg_ref;
44601         CHECK(a_arg->arr_len == 33);
44602         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
44603         LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
44604         uint64_t ret_ref = 0;
44605         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44606         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44607         return ret_ref;
44608 }
44609
44610 static inline uint64_t PayeePubKey_clone_ptr(LDKPayeePubKey *NONNULL_PTR arg) {
44611         LDKPayeePubKey ret_var = PayeePubKey_clone(arg);
44612         uint64_t ret_ref = 0;
44613         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44614         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44615         return ret_ref;
44616 }
44617 int64_t  __attribute__((export_name("TS_PayeePubKey_clone_ptr"))) TS_PayeePubKey_clone_ptr(uint64_t arg) {
44618         LDKPayeePubKey arg_conv;
44619         arg_conv.inner = untag_ptr(arg);
44620         arg_conv.is_owned = ptr_is_owned(arg);
44621         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44622         arg_conv.is_owned = false;
44623         int64_t ret_conv = PayeePubKey_clone_ptr(&arg_conv);
44624         return ret_conv;
44625 }
44626
44627 uint64_t  __attribute__((export_name("TS_PayeePubKey_clone"))) TS_PayeePubKey_clone(uint64_t orig) {
44628         LDKPayeePubKey orig_conv;
44629         orig_conv.inner = untag_ptr(orig);
44630         orig_conv.is_owned = ptr_is_owned(orig);
44631         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44632         orig_conv.is_owned = false;
44633         LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
44634         uint64_t ret_ref = 0;
44635         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44636         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44637         return ret_ref;
44638 }
44639
44640 int64_t  __attribute__((export_name("TS_PayeePubKey_hash"))) TS_PayeePubKey_hash(uint64_t o) {
44641         LDKPayeePubKey o_conv;
44642         o_conv.inner = untag_ptr(o);
44643         o_conv.is_owned = ptr_is_owned(o);
44644         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44645         o_conv.is_owned = false;
44646         int64_t ret_conv = PayeePubKey_hash(&o_conv);
44647         return ret_conv;
44648 }
44649
44650 jboolean  __attribute__((export_name("TS_PayeePubKey_eq"))) TS_PayeePubKey_eq(uint64_t a, uint64_t b) {
44651         LDKPayeePubKey a_conv;
44652         a_conv.inner = untag_ptr(a);
44653         a_conv.is_owned = ptr_is_owned(a);
44654         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44655         a_conv.is_owned = false;
44656         LDKPayeePubKey b_conv;
44657         b_conv.inner = untag_ptr(b);
44658         b_conv.is_owned = ptr_is_owned(b);
44659         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44660         b_conv.is_owned = false;
44661         jboolean ret_conv = PayeePubKey_eq(&a_conv, &b_conv);
44662         return ret_conv;
44663 }
44664
44665 void  __attribute__((export_name("TS_ExpiryTime_free"))) TS_ExpiryTime_free(uint64_t this_obj) {
44666         LDKExpiryTime this_obj_conv;
44667         this_obj_conv.inner = untag_ptr(this_obj);
44668         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44670         ExpiryTime_free(this_obj_conv);
44671 }
44672
44673 static inline uint64_t ExpiryTime_clone_ptr(LDKExpiryTime *NONNULL_PTR arg) {
44674         LDKExpiryTime ret_var = ExpiryTime_clone(arg);
44675         uint64_t ret_ref = 0;
44676         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44677         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44678         return ret_ref;
44679 }
44680 int64_t  __attribute__((export_name("TS_ExpiryTime_clone_ptr"))) TS_ExpiryTime_clone_ptr(uint64_t arg) {
44681         LDKExpiryTime arg_conv;
44682         arg_conv.inner = untag_ptr(arg);
44683         arg_conv.is_owned = ptr_is_owned(arg);
44684         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44685         arg_conv.is_owned = false;
44686         int64_t ret_conv = ExpiryTime_clone_ptr(&arg_conv);
44687         return ret_conv;
44688 }
44689
44690 uint64_t  __attribute__((export_name("TS_ExpiryTime_clone"))) TS_ExpiryTime_clone(uint64_t orig) {
44691         LDKExpiryTime orig_conv;
44692         orig_conv.inner = untag_ptr(orig);
44693         orig_conv.is_owned = ptr_is_owned(orig);
44694         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44695         orig_conv.is_owned = false;
44696         LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
44697         uint64_t ret_ref = 0;
44698         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44699         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44700         return ret_ref;
44701 }
44702
44703 int64_t  __attribute__((export_name("TS_ExpiryTime_hash"))) TS_ExpiryTime_hash(uint64_t o) {
44704         LDKExpiryTime o_conv;
44705         o_conv.inner = untag_ptr(o);
44706         o_conv.is_owned = ptr_is_owned(o);
44707         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44708         o_conv.is_owned = false;
44709         int64_t ret_conv = ExpiryTime_hash(&o_conv);
44710         return ret_conv;
44711 }
44712
44713 jboolean  __attribute__((export_name("TS_ExpiryTime_eq"))) TS_ExpiryTime_eq(uint64_t a, uint64_t b) {
44714         LDKExpiryTime a_conv;
44715         a_conv.inner = untag_ptr(a);
44716         a_conv.is_owned = ptr_is_owned(a);
44717         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44718         a_conv.is_owned = false;
44719         LDKExpiryTime b_conv;
44720         b_conv.inner = untag_ptr(b);
44721         b_conv.is_owned = ptr_is_owned(b);
44722         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44723         b_conv.is_owned = false;
44724         jboolean ret_conv = ExpiryTime_eq(&a_conv, &b_conv);
44725         return ret_conv;
44726 }
44727
44728 void  __attribute__((export_name("TS_MinFinalCltvExpiry_free"))) TS_MinFinalCltvExpiry_free(uint64_t this_obj) {
44729         LDKMinFinalCltvExpiry this_obj_conv;
44730         this_obj_conv.inner = untag_ptr(this_obj);
44731         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44733         MinFinalCltvExpiry_free(this_obj_conv);
44734 }
44735
44736 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiry_get_a"))) TS_MinFinalCltvExpiry_get_a(uint64_t this_ptr) {
44737         LDKMinFinalCltvExpiry this_ptr_conv;
44738         this_ptr_conv.inner = untag_ptr(this_ptr);
44739         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44741         this_ptr_conv.is_owned = false;
44742         int64_t ret_conv = MinFinalCltvExpiry_get_a(&this_ptr_conv);
44743         return ret_conv;
44744 }
44745
44746 void  __attribute__((export_name("TS_MinFinalCltvExpiry_set_a"))) TS_MinFinalCltvExpiry_set_a(uint64_t this_ptr, int64_t val) {
44747         LDKMinFinalCltvExpiry this_ptr_conv;
44748         this_ptr_conv.inner = untag_ptr(this_ptr);
44749         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44751         this_ptr_conv.is_owned = false;
44752         MinFinalCltvExpiry_set_a(&this_ptr_conv, val);
44753 }
44754
44755 uint64_t  __attribute__((export_name("TS_MinFinalCltvExpiry_new"))) TS_MinFinalCltvExpiry_new(int64_t a_arg) {
44756         LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_new(a_arg);
44757         uint64_t ret_ref = 0;
44758         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44759         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44760         return ret_ref;
44761 }
44762
44763 static inline uint64_t MinFinalCltvExpiry_clone_ptr(LDKMinFinalCltvExpiry *NONNULL_PTR arg) {
44764         LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(arg);
44765         uint64_t ret_ref = 0;
44766         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44767         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44768         return ret_ref;
44769 }
44770 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiry_clone_ptr"))) TS_MinFinalCltvExpiry_clone_ptr(uint64_t arg) {
44771         LDKMinFinalCltvExpiry arg_conv;
44772         arg_conv.inner = untag_ptr(arg);
44773         arg_conv.is_owned = ptr_is_owned(arg);
44774         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44775         arg_conv.is_owned = false;
44776         int64_t ret_conv = MinFinalCltvExpiry_clone_ptr(&arg_conv);
44777         return ret_conv;
44778 }
44779
44780 uint64_t  __attribute__((export_name("TS_MinFinalCltvExpiry_clone"))) TS_MinFinalCltvExpiry_clone(uint64_t orig) {
44781         LDKMinFinalCltvExpiry orig_conv;
44782         orig_conv.inner = untag_ptr(orig);
44783         orig_conv.is_owned = ptr_is_owned(orig);
44784         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44785         orig_conv.is_owned = false;
44786         LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv);
44787         uint64_t ret_ref = 0;
44788         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44789         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44790         return ret_ref;
44791 }
44792
44793 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiry_hash"))) TS_MinFinalCltvExpiry_hash(uint64_t o) {
44794         LDKMinFinalCltvExpiry o_conv;
44795         o_conv.inner = untag_ptr(o);
44796         o_conv.is_owned = ptr_is_owned(o);
44797         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44798         o_conv.is_owned = false;
44799         int64_t ret_conv = MinFinalCltvExpiry_hash(&o_conv);
44800         return ret_conv;
44801 }
44802
44803 jboolean  __attribute__((export_name("TS_MinFinalCltvExpiry_eq"))) TS_MinFinalCltvExpiry_eq(uint64_t a, uint64_t b) {
44804         LDKMinFinalCltvExpiry a_conv;
44805         a_conv.inner = untag_ptr(a);
44806         a_conv.is_owned = ptr_is_owned(a);
44807         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44808         a_conv.is_owned = false;
44809         LDKMinFinalCltvExpiry b_conv;
44810         b_conv.inner = untag_ptr(b);
44811         b_conv.is_owned = ptr_is_owned(b);
44812         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44813         b_conv.is_owned = false;
44814         jboolean ret_conv = MinFinalCltvExpiry_eq(&a_conv, &b_conv);
44815         return ret_conv;
44816 }
44817
44818 void  __attribute__((export_name("TS_Fallback_free"))) TS_Fallback_free(uint64_t this_ptr) {
44819         if (!ptr_is_owned(this_ptr)) return;
44820         void* this_ptr_ptr = untag_ptr(this_ptr);
44821         CHECK_ACCESS(this_ptr_ptr);
44822         LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
44823         FREE(untag_ptr(this_ptr));
44824         Fallback_free(this_ptr_conv);
44825 }
44826
44827 static inline uint64_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg) {
44828         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
44829         *ret_copy = Fallback_clone(arg);
44830         uint64_t ret_ref = tag_ptr(ret_copy, true);
44831         return ret_ref;
44832 }
44833 int64_t  __attribute__((export_name("TS_Fallback_clone_ptr"))) TS_Fallback_clone_ptr(uint64_t arg) {
44834         LDKFallback* arg_conv = (LDKFallback*)untag_ptr(arg);
44835         int64_t ret_conv = Fallback_clone_ptr(arg_conv);
44836         return ret_conv;
44837 }
44838
44839 uint64_t  __attribute__((export_name("TS_Fallback_clone"))) TS_Fallback_clone(uint64_t orig) {
44840         LDKFallback* orig_conv = (LDKFallback*)untag_ptr(orig);
44841         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
44842         *ret_copy = Fallback_clone(orig_conv);
44843         uint64_t ret_ref = tag_ptr(ret_copy, true);
44844         return ret_ref;
44845 }
44846
44847 uint64_t  __attribute__((export_name("TS_Fallback_seg_wit_program"))) TS_Fallback_seg_wit_program(int8_t version, int8_tArray program) {
44848         
44849         LDKCVec_u8Z program_ref;
44850         program_ref.datalen = program->arr_len;
44851         program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
44852         memcpy(program_ref.data, program->elems, program_ref.datalen); FREE(program);
44853         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
44854         *ret_copy = Fallback_seg_wit_program((LDKu5){ ._0 = version }, program_ref);
44855         uint64_t ret_ref = tag_ptr(ret_copy, true);
44856         return ret_ref;
44857 }
44858
44859 uint64_t  __attribute__((export_name("TS_Fallback_pub_key_hash"))) TS_Fallback_pub_key_hash(int8_tArray a) {
44860         LDKTwentyBytes a_ref;
44861         CHECK(a->arr_len == 20);
44862         memcpy(a_ref.data, a->elems, 20); FREE(a);
44863         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
44864         *ret_copy = Fallback_pub_key_hash(a_ref);
44865         uint64_t ret_ref = tag_ptr(ret_copy, true);
44866         return ret_ref;
44867 }
44868
44869 uint64_t  __attribute__((export_name("TS_Fallback_script_hash"))) TS_Fallback_script_hash(int8_tArray a) {
44870         LDKTwentyBytes a_ref;
44871         CHECK(a->arr_len == 20);
44872         memcpy(a_ref.data, a->elems, 20); FREE(a);
44873         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
44874         *ret_copy = Fallback_script_hash(a_ref);
44875         uint64_t ret_ref = tag_ptr(ret_copy, true);
44876         return ret_ref;
44877 }
44878
44879 int64_t  __attribute__((export_name("TS_Fallback_hash"))) TS_Fallback_hash(uint64_t o) {
44880         LDKFallback* o_conv = (LDKFallback*)untag_ptr(o);
44881         int64_t ret_conv = Fallback_hash(o_conv);
44882         return ret_conv;
44883 }
44884
44885 jboolean  __attribute__((export_name("TS_Fallback_eq"))) TS_Fallback_eq(uint64_t a, uint64_t b) {
44886         LDKFallback* a_conv = (LDKFallback*)untag_ptr(a);
44887         LDKFallback* b_conv = (LDKFallback*)untag_ptr(b);
44888         jboolean ret_conv = Fallback_eq(a_conv, b_conv);
44889         return ret_conv;
44890 }
44891
44892 void  __attribute__((export_name("TS_InvoiceSignature_free"))) TS_InvoiceSignature_free(uint64_t this_obj) {
44893         LDKInvoiceSignature this_obj_conv;
44894         this_obj_conv.inner = untag_ptr(this_obj);
44895         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44896         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44897         InvoiceSignature_free(this_obj_conv);
44898 }
44899
44900 static inline uint64_t InvoiceSignature_clone_ptr(LDKInvoiceSignature *NONNULL_PTR arg) {
44901         LDKInvoiceSignature ret_var = InvoiceSignature_clone(arg);
44902         uint64_t ret_ref = 0;
44903         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44904         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44905         return ret_ref;
44906 }
44907 int64_t  __attribute__((export_name("TS_InvoiceSignature_clone_ptr"))) TS_InvoiceSignature_clone_ptr(uint64_t arg) {
44908         LDKInvoiceSignature arg_conv;
44909         arg_conv.inner = untag_ptr(arg);
44910         arg_conv.is_owned = ptr_is_owned(arg);
44911         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44912         arg_conv.is_owned = false;
44913         int64_t ret_conv = InvoiceSignature_clone_ptr(&arg_conv);
44914         return ret_conv;
44915 }
44916
44917 uint64_t  __attribute__((export_name("TS_InvoiceSignature_clone"))) TS_InvoiceSignature_clone(uint64_t orig) {
44918         LDKInvoiceSignature orig_conv;
44919         orig_conv.inner = untag_ptr(orig);
44920         orig_conv.is_owned = ptr_is_owned(orig);
44921         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44922         orig_conv.is_owned = false;
44923         LDKInvoiceSignature ret_var = InvoiceSignature_clone(&orig_conv);
44924         uint64_t ret_ref = 0;
44925         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44926         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44927         return ret_ref;
44928 }
44929
44930 int64_t  __attribute__((export_name("TS_InvoiceSignature_hash"))) TS_InvoiceSignature_hash(uint64_t o) {
44931         LDKInvoiceSignature o_conv;
44932         o_conv.inner = untag_ptr(o);
44933         o_conv.is_owned = ptr_is_owned(o);
44934         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44935         o_conv.is_owned = false;
44936         int64_t ret_conv = InvoiceSignature_hash(&o_conv);
44937         return ret_conv;
44938 }
44939
44940 jboolean  __attribute__((export_name("TS_InvoiceSignature_eq"))) TS_InvoiceSignature_eq(uint64_t a, uint64_t b) {
44941         LDKInvoiceSignature a_conv;
44942         a_conv.inner = untag_ptr(a);
44943         a_conv.is_owned = ptr_is_owned(a);
44944         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44945         a_conv.is_owned = false;
44946         LDKInvoiceSignature b_conv;
44947         b_conv.inner = untag_ptr(b);
44948         b_conv.is_owned = ptr_is_owned(b);
44949         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44950         b_conv.is_owned = false;
44951         jboolean ret_conv = InvoiceSignature_eq(&a_conv, &b_conv);
44952         return ret_conv;
44953 }
44954
44955 void  __attribute__((export_name("TS_PrivateRoute_free"))) TS_PrivateRoute_free(uint64_t this_obj) {
44956         LDKPrivateRoute this_obj_conv;
44957         this_obj_conv.inner = untag_ptr(this_obj);
44958         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44960         PrivateRoute_free(this_obj_conv);
44961 }
44962
44963 static inline uint64_t PrivateRoute_clone_ptr(LDKPrivateRoute *NONNULL_PTR arg) {
44964         LDKPrivateRoute ret_var = PrivateRoute_clone(arg);
44965         uint64_t ret_ref = 0;
44966         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44967         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44968         return ret_ref;
44969 }
44970 int64_t  __attribute__((export_name("TS_PrivateRoute_clone_ptr"))) TS_PrivateRoute_clone_ptr(uint64_t arg) {
44971         LDKPrivateRoute arg_conv;
44972         arg_conv.inner = untag_ptr(arg);
44973         arg_conv.is_owned = ptr_is_owned(arg);
44974         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44975         arg_conv.is_owned = false;
44976         int64_t ret_conv = PrivateRoute_clone_ptr(&arg_conv);
44977         return ret_conv;
44978 }
44979
44980 uint64_t  __attribute__((export_name("TS_PrivateRoute_clone"))) TS_PrivateRoute_clone(uint64_t orig) {
44981         LDKPrivateRoute orig_conv;
44982         orig_conv.inner = untag_ptr(orig);
44983         orig_conv.is_owned = ptr_is_owned(orig);
44984         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44985         orig_conv.is_owned = false;
44986         LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
44987         uint64_t ret_ref = 0;
44988         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44989         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44990         return ret_ref;
44991 }
44992
44993 int64_t  __attribute__((export_name("TS_PrivateRoute_hash"))) TS_PrivateRoute_hash(uint64_t o) {
44994         LDKPrivateRoute o_conv;
44995         o_conv.inner = untag_ptr(o);
44996         o_conv.is_owned = ptr_is_owned(o);
44997         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44998         o_conv.is_owned = false;
44999         int64_t ret_conv = PrivateRoute_hash(&o_conv);
45000         return ret_conv;
45001 }
45002
45003 jboolean  __attribute__((export_name("TS_PrivateRoute_eq"))) TS_PrivateRoute_eq(uint64_t a, uint64_t b) {
45004         LDKPrivateRoute a_conv;
45005         a_conv.inner = untag_ptr(a);
45006         a_conv.is_owned = ptr_is_owned(a);
45007         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45008         a_conv.is_owned = false;
45009         LDKPrivateRoute b_conv;
45010         b_conv.inner = untag_ptr(b);
45011         b_conv.is_owned = ptr_is_owned(b);
45012         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45013         b_conv.is_owned = false;
45014         jboolean ret_conv = PrivateRoute_eq(&a_conv, &b_conv);
45015         return ret_conv;
45016 }
45017
45018 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_into_parts"))) TS_SignedRawInvoice_into_parts(uint64_t this_arg) {
45019         LDKSignedRawInvoice this_arg_conv;
45020         this_arg_conv.inner = untag_ptr(this_arg);
45021         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45023         this_arg_conv = SignedRawInvoice_clone(&this_arg_conv);
45024         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
45025         *ret_conv = SignedRawInvoice_into_parts(this_arg_conv);
45026         return tag_ptr(ret_conv, true);
45027 }
45028
45029 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_raw_invoice"))) TS_SignedRawInvoice_raw_invoice(uint64_t this_arg) {
45030         LDKSignedRawInvoice this_arg_conv;
45031         this_arg_conv.inner = untag_ptr(this_arg);
45032         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45034         this_arg_conv.is_owned = false;
45035         LDKRawInvoice ret_var = SignedRawInvoice_raw_invoice(&this_arg_conv);
45036         uint64_t ret_ref = 0;
45037         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45038         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45039         return ret_ref;
45040 }
45041
45042 int8_tArray  __attribute__((export_name("TS_SignedRawInvoice_signable_hash"))) TS_SignedRawInvoice_signable_hash(uint64_t this_arg) {
45043         LDKSignedRawInvoice this_arg_conv;
45044         this_arg_conv.inner = untag_ptr(this_arg);
45045         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45046         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45047         this_arg_conv.is_owned = false;
45048         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
45049         memcpy(ret_arr->elems, *SignedRawInvoice_signable_hash(&this_arg_conv), 32);
45050         return ret_arr;
45051 }
45052
45053 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_signature"))) TS_SignedRawInvoice_signature(uint64_t this_arg) {
45054         LDKSignedRawInvoice this_arg_conv;
45055         this_arg_conv.inner = untag_ptr(this_arg);
45056         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45058         this_arg_conv.is_owned = false;
45059         LDKInvoiceSignature ret_var = SignedRawInvoice_signature(&this_arg_conv);
45060         uint64_t ret_ref = 0;
45061         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45062         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45063         return ret_ref;
45064 }
45065
45066 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_recover_payee_pub_key"))) TS_SignedRawInvoice_recover_payee_pub_key(uint64_t this_arg) {
45067         LDKSignedRawInvoice this_arg_conv;
45068         this_arg_conv.inner = untag_ptr(this_arg);
45069         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45071         this_arg_conv.is_owned = false;
45072         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
45073         *ret_conv = SignedRawInvoice_recover_payee_pub_key(&this_arg_conv);
45074         return tag_ptr(ret_conv, true);
45075 }
45076
45077 jboolean  __attribute__((export_name("TS_SignedRawInvoice_check_signature"))) TS_SignedRawInvoice_check_signature(uint64_t this_arg) {
45078         LDKSignedRawInvoice this_arg_conv;
45079         this_arg_conv.inner = untag_ptr(this_arg);
45080         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45081         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45082         this_arg_conv.is_owned = false;
45083         jboolean ret_conv = SignedRawInvoice_check_signature(&this_arg_conv);
45084         return ret_conv;
45085 }
45086
45087 int8_tArray  __attribute__((export_name("TS_RawInvoice_signable_hash"))) TS_RawInvoice_signable_hash(uint64_t this_arg) {
45088         LDKRawInvoice this_arg_conv;
45089         this_arg_conv.inner = untag_ptr(this_arg);
45090         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45092         this_arg_conv.is_owned = false;
45093         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
45094         memcpy(ret_arr->elems, RawInvoice_signable_hash(&this_arg_conv).data, 32);
45095         return ret_arr;
45096 }
45097
45098 uint64_t  __attribute__((export_name("TS_RawInvoice_payment_hash"))) TS_RawInvoice_payment_hash(uint64_t this_arg) {
45099         LDKRawInvoice this_arg_conv;
45100         this_arg_conv.inner = untag_ptr(this_arg);
45101         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45103         this_arg_conv.is_owned = false;
45104         LDKSha256 ret_var = RawInvoice_payment_hash(&this_arg_conv);
45105         uint64_t ret_ref = 0;
45106         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45107         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45108         return ret_ref;
45109 }
45110
45111 uint64_t  __attribute__((export_name("TS_RawInvoice_description"))) TS_RawInvoice_description(uint64_t this_arg) {
45112         LDKRawInvoice this_arg_conv;
45113         this_arg_conv.inner = untag_ptr(this_arg);
45114         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45116         this_arg_conv.is_owned = false;
45117         LDKDescription ret_var = RawInvoice_description(&this_arg_conv);
45118         uint64_t ret_ref = 0;
45119         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45120         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45121         return ret_ref;
45122 }
45123
45124 uint64_t  __attribute__((export_name("TS_RawInvoice_payee_pub_key"))) TS_RawInvoice_payee_pub_key(uint64_t this_arg) {
45125         LDKRawInvoice this_arg_conv;
45126         this_arg_conv.inner = untag_ptr(this_arg);
45127         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45129         this_arg_conv.is_owned = false;
45130         LDKPayeePubKey ret_var = RawInvoice_payee_pub_key(&this_arg_conv);
45131         uint64_t ret_ref = 0;
45132         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45133         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45134         return ret_ref;
45135 }
45136
45137 uint64_t  __attribute__((export_name("TS_RawInvoice_description_hash"))) TS_RawInvoice_description_hash(uint64_t this_arg) {
45138         LDKRawInvoice this_arg_conv;
45139         this_arg_conv.inner = untag_ptr(this_arg);
45140         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45142         this_arg_conv.is_owned = false;
45143         LDKSha256 ret_var = RawInvoice_description_hash(&this_arg_conv);
45144         uint64_t ret_ref = 0;
45145         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45146         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45147         return ret_ref;
45148 }
45149
45150 uint64_t  __attribute__((export_name("TS_RawInvoice_expiry_time"))) TS_RawInvoice_expiry_time(uint64_t this_arg) {
45151         LDKRawInvoice this_arg_conv;
45152         this_arg_conv.inner = untag_ptr(this_arg);
45153         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45155         this_arg_conv.is_owned = false;
45156         LDKExpiryTime ret_var = RawInvoice_expiry_time(&this_arg_conv);
45157         uint64_t ret_ref = 0;
45158         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45159         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45160         return ret_ref;
45161 }
45162
45163 uint64_t  __attribute__((export_name("TS_RawInvoice_min_final_cltv_expiry"))) TS_RawInvoice_min_final_cltv_expiry(uint64_t this_arg) {
45164         LDKRawInvoice this_arg_conv;
45165         this_arg_conv.inner = untag_ptr(this_arg);
45166         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45168         this_arg_conv.is_owned = false;
45169         LDKMinFinalCltvExpiry ret_var = RawInvoice_min_final_cltv_expiry(&this_arg_conv);
45170         uint64_t ret_ref = 0;
45171         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45172         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45173         return ret_ref;
45174 }
45175
45176 int8_tArray  __attribute__((export_name("TS_RawInvoice_payment_secret"))) TS_RawInvoice_payment_secret(uint64_t this_arg) {
45177         LDKRawInvoice this_arg_conv;
45178         this_arg_conv.inner = untag_ptr(this_arg);
45179         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45181         this_arg_conv.is_owned = false;
45182         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
45183         memcpy(ret_arr->elems, RawInvoice_payment_secret(&this_arg_conv).data, 32);
45184         return ret_arr;
45185 }
45186
45187 uint64_t  __attribute__((export_name("TS_RawInvoice_features"))) TS_RawInvoice_features(uint64_t this_arg) {
45188         LDKRawInvoice this_arg_conv;
45189         this_arg_conv.inner = untag_ptr(this_arg);
45190         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45192         this_arg_conv.is_owned = false;
45193         LDKInvoiceFeatures ret_var = RawInvoice_features(&this_arg_conv);
45194         uint64_t ret_ref = 0;
45195         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45196         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45197         return ret_ref;
45198 }
45199
45200 uint64_tArray  __attribute__((export_name("TS_RawInvoice_private_routes"))) TS_RawInvoice_private_routes(uint64_t this_arg) {
45201         LDKRawInvoice this_arg_conv;
45202         this_arg_conv.inner = untag_ptr(this_arg);
45203         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45204         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45205         this_arg_conv.is_owned = false;
45206         LDKCVec_PrivateRouteZ ret_var = RawInvoice_private_routes(&this_arg_conv);
45207         uint64_tArray ret_arr = NULL;
45208         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
45209         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
45210         for (size_t o = 0; o < ret_var.datalen; o++) {
45211                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
45212                 uint64_t ret_conv_14_ref = 0;
45213                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
45214                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
45215                 ret_arr_ptr[o] = ret_conv_14_ref;
45216         }
45217         
45218         FREE(ret_var.data);
45219         return ret_arr;
45220 }
45221
45222 uint64_t  __attribute__((export_name("TS_RawInvoice_amount_pico_btc"))) TS_RawInvoice_amount_pico_btc(uint64_t this_arg) {
45223         LDKRawInvoice this_arg_conv;
45224         this_arg_conv.inner = untag_ptr(this_arg);
45225         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45227         this_arg_conv.is_owned = false;
45228         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
45229         *ret_copy = RawInvoice_amount_pico_btc(&this_arg_conv);
45230         uint64_t ret_ref = tag_ptr(ret_copy, true);
45231         return ret_ref;
45232 }
45233
45234 uint32_t  __attribute__((export_name("TS_RawInvoice_currency"))) TS_RawInvoice_currency(uint64_t this_arg) {
45235         LDKRawInvoice this_arg_conv;
45236         this_arg_conv.inner = untag_ptr(this_arg);
45237         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45239         this_arg_conv.is_owned = false;
45240         uint32_t ret_conv = LDKCurrency_to_js(RawInvoice_currency(&this_arg_conv));
45241         return ret_conv;
45242 }
45243
45244 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_from_unix_timestamp"))) TS_PositiveTimestamp_from_unix_timestamp(int64_t unix_seconds) {
45245         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
45246         *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
45247         return tag_ptr(ret_conv, true);
45248 }
45249
45250 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_from_duration_since_epoch"))) TS_PositiveTimestamp_from_duration_since_epoch(int64_t duration) {
45251         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
45252         *ret_conv = PositiveTimestamp_from_duration_since_epoch(duration);
45253         return tag_ptr(ret_conv, true);
45254 }
45255
45256 int64_t  __attribute__((export_name("TS_PositiveTimestamp_as_unix_timestamp"))) TS_PositiveTimestamp_as_unix_timestamp(uint64_t this_arg) {
45257         LDKPositiveTimestamp this_arg_conv;
45258         this_arg_conv.inner = untag_ptr(this_arg);
45259         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45261         this_arg_conv.is_owned = false;
45262         int64_t ret_conv = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
45263         return ret_conv;
45264 }
45265
45266 int64_t  __attribute__((export_name("TS_PositiveTimestamp_as_duration_since_epoch"))) TS_PositiveTimestamp_as_duration_since_epoch(uint64_t this_arg) {
45267         LDKPositiveTimestamp this_arg_conv;
45268         this_arg_conv.inner = untag_ptr(this_arg);
45269         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45271         this_arg_conv.is_owned = false;
45272         int64_t ret_conv = PositiveTimestamp_as_duration_since_epoch(&this_arg_conv);
45273         return ret_conv;
45274 }
45275
45276 uint64_t  __attribute__((export_name("TS_Invoice_into_signed_raw"))) TS_Invoice_into_signed_raw(uint64_t this_arg) {
45277         LDKInvoice this_arg_conv;
45278         this_arg_conv.inner = untag_ptr(this_arg);
45279         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45281         this_arg_conv = Invoice_clone(&this_arg_conv);
45282         LDKSignedRawInvoice ret_var = Invoice_into_signed_raw(this_arg_conv);
45283         uint64_t ret_ref = 0;
45284         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45285         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45286         return ret_ref;
45287 }
45288
45289 uint64_t  __attribute__((export_name("TS_Invoice_check_signature"))) TS_Invoice_check_signature(uint64_t this_arg) {
45290         LDKInvoice this_arg_conv;
45291         this_arg_conv.inner = untag_ptr(this_arg);
45292         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45294         this_arg_conv.is_owned = false;
45295         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
45296         *ret_conv = Invoice_check_signature(&this_arg_conv);
45297         return tag_ptr(ret_conv, true);
45298 }
45299
45300 uint64_t  __attribute__((export_name("TS_Invoice_from_signed"))) TS_Invoice_from_signed(uint64_t signed_invoice) {
45301         LDKSignedRawInvoice signed_invoice_conv;
45302         signed_invoice_conv.inner = untag_ptr(signed_invoice);
45303         signed_invoice_conv.is_owned = ptr_is_owned(signed_invoice);
45304         CHECK_INNER_FIELD_ACCESS_OR_NULL(signed_invoice_conv);
45305         signed_invoice_conv = SignedRawInvoice_clone(&signed_invoice_conv);
45306         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
45307         *ret_conv = Invoice_from_signed(signed_invoice_conv);
45308         return tag_ptr(ret_conv, true);
45309 }
45310
45311 int64_t  __attribute__((export_name("TS_Invoice_duration_since_epoch"))) TS_Invoice_duration_since_epoch(uint64_t this_arg) {
45312         LDKInvoice this_arg_conv;
45313         this_arg_conv.inner = untag_ptr(this_arg);
45314         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45316         this_arg_conv.is_owned = false;
45317         int64_t ret_conv = Invoice_duration_since_epoch(&this_arg_conv);
45318         return ret_conv;
45319 }
45320
45321 int8_tArray  __attribute__((export_name("TS_Invoice_payment_hash"))) TS_Invoice_payment_hash(uint64_t this_arg) {
45322         LDKInvoice this_arg_conv;
45323         this_arg_conv.inner = untag_ptr(this_arg);
45324         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45326         this_arg_conv.is_owned = false;
45327         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
45328         memcpy(ret_arr->elems, *Invoice_payment_hash(&this_arg_conv), 32);
45329         return ret_arr;
45330 }
45331
45332 int8_tArray  __attribute__((export_name("TS_Invoice_payee_pub_key"))) TS_Invoice_payee_pub_key(uint64_t this_arg) {
45333         LDKInvoice this_arg_conv;
45334         this_arg_conv.inner = untag_ptr(this_arg);
45335         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45337         this_arg_conv.is_owned = false;
45338         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
45339         memcpy(ret_arr->elems, Invoice_payee_pub_key(&this_arg_conv).compressed_form, 33);
45340         return ret_arr;
45341 }
45342
45343 int8_tArray  __attribute__((export_name("TS_Invoice_payment_secret"))) TS_Invoice_payment_secret(uint64_t this_arg) {
45344         LDKInvoice this_arg_conv;
45345         this_arg_conv.inner = untag_ptr(this_arg);
45346         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45348         this_arg_conv.is_owned = false;
45349         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
45350         memcpy(ret_arr->elems, *Invoice_payment_secret(&this_arg_conv), 32);
45351         return ret_arr;
45352 }
45353
45354 uint64_t  __attribute__((export_name("TS_Invoice_features"))) TS_Invoice_features(uint64_t this_arg) {
45355         LDKInvoice this_arg_conv;
45356         this_arg_conv.inner = untag_ptr(this_arg);
45357         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45359         this_arg_conv.is_owned = false;
45360         LDKInvoiceFeatures ret_var = Invoice_features(&this_arg_conv);
45361         uint64_t ret_ref = 0;
45362         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45363         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45364         return ret_ref;
45365 }
45366
45367 int8_tArray  __attribute__((export_name("TS_Invoice_recover_payee_pub_key"))) TS_Invoice_recover_payee_pub_key(uint64_t this_arg) {
45368         LDKInvoice this_arg_conv;
45369         this_arg_conv.inner = untag_ptr(this_arg);
45370         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45371         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45372         this_arg_conv.is_owned = false;
45373         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
45374         memcpy(ret_arr->elems, Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form, 33);
45375         return ret_arr;
45376 }
45377
45378 int64_t  __attribute__((export_name("TS_Invoice_expiry_time"))) TS_Invoice_expiry_time(uint64_t this_arg) {
45379         LDKInvoice this_arg_conv;
45380         this_arg_conv.inner = untag_ptr(this_arg);
45381         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45383         this_arg_conv.is_owned = false;
45384         int64_t ret_conv = Invoice_expiry_time(&this_arg_conv);
45385         return ret_conv;
45386 }
45387
45388 jboolean  __attribute__((export_name("TS_Invoice_would_expire"))) TS_Invoice_would_expire(uint64_t this_arg, int64_t at_time) {
45389         LDKInvoice this_arg_conv;
45390         this_arg_conv.inner = untag_ptr(this_arg);
45391         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45392         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45393         this_arg_conv.is_owned = false;
45394         jboolean ret_conv = Invoice_would_expire(&this_arg_conv, at_time);
45395         return ret_conv;
45396 }
45397
45398 int64_t  __attribute__((export_name("TS_Invoice_min_final_cltv_expiry"))) TS_Invoice_min_final_cltv_expiry(uint64_t this_arg) {
45399         LDKInvoice this_arg_conv;
45400         this_arg_conv.inner = untag_ptr(this_arg);
45401         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45403         this_arg_conv.is_owned = false;
45404         int64_t ret_conv = Invoice_min_final_cltv_expiry(&this_arg_conv);
45405         return ret_conv;
45406 }
45407
45408 uint64_tArray  __attribute__((export_name("TS_Invoice_private_routes"))) TS_Invoice_private_routes(uint64_t this_arg) {
45409         LDKInvoice this_arg_conv;
45410         this_arg_conv.inner = untag_ptr(this_arg);
45411         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45413         this_arg_conv.is_owned = false;
45414         LDKCVec_PrivateRouteZ ret_var = Invoice_private_routes(&this_arg_conv);
45415         uint64_tArray ret_arr = NULL;
45416         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
45417         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
45418         for (size_t o = 0; o < ret_var.datalen; o++) {
45419                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
45420                 uint64_t ret_conv_14_ref = 0;
45421                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
45422                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
45423                 ret_arr_ptr[o] = ret_conv_14_ref;
45424         }
45425         
45426         FREE(ret_var.data);
45427         return ret_arr;
45428 }
45429
45430 uint64_tArray  __attribute__((export_name("TS_Invoice_route_hints"))) TS_Invoice_route_hints(uint64_t this_arg) {
45431         LDKInvoice this_arg_conv;
45432         this_arg_conv.inner = untag_ptr(this_arg);
45433         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45434         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45435         this_arg_conv.is_owned = false;
45436         LDKCVec_RouteHintZ ret_var = Invoice_route_hints(&this_arg_conv);
45437         uint64_tArray ret_arr = NULL;
45438         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
45439         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
45440         for (size_t l = 0; l < ret_var.datalen; l++) {
45441                 LDKRouteHint ret_conv_11_var = ret_var.data[l];
45442                 uint64_t ret_conv_11_ref = 0;
45443                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
45444                 ret_conv_11_ref = tag_ptr(ret_conv_11_var.inner, ret_conv_11_var.is_owned);
45445                 ret_arr_ptr[l] = ret_conv_11_ref;
45446         }
45447         
45448         FREE(ret_var.data);
45449         return ret_arr;
45450 }
45451
45452 uint32_t  __attribute__((export_name("TS_Invoice_currency"))) TS_Invoice_currency(uint64_t this_arg) {
45453         LDKInvoice this_arg_conv;
45454         this_arg_conv.inner = untag_ptr(this_arg);
45455         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45457         this_arg_conv.is_owned = false;
45458         uint32_t ret_conv = LDKCurrency_to_js(Invoice_currency(&this_arg_conv));
45459         return ret_conv;
45460 }
45461
45462 uint64_t  __attribute__((export_name("TS_Invoice_amount_milli_satoshis"))) TS_Invoice_amount_milli_satoshis(uint64_t this_arg) {
45463         LDKInvoice this_arg_conv;
45464         this_arg_conv.inner = untag_ptr(this_arg);
45465         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45467         this_arg_conv.is_owned = false;
45468         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
45469         *ret_copy = Invoice_amount_milli_satoshis(&this_arg_conv);
45470         uint64_t ret_ref = tag_ptr(ret_copy, true);
45471         return ret_ref;
45472 }
45473
45474 uint64_t  __attribute__((export_name("TS_Description_new"))) TS_Description_new(jstring description) {
45475         LDKStr description_conv = str_ref_to_owned_c(description);
45476         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
45477         *ret_conv = Description_new(description_conv);
45478         return tag_ptr(ret_conv, true);
45479 }
45480
45481 jstring  __attribute__((export_name("TS_Description_into_inner"))) TS_Description_into_inner(uint64_t this_arg) {
45482         LDKDescription this_arg_conv;
45483         this_arg_conv.inner = untag_ptr(this_arg);
45484         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45486         this_arg_conv = Description_clone(&this_arg_conv);
45487         LDKStr ret_str = Description_into_inner(this_arg_conv);
45488         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
45489         Str_free(ret_str);
45490         return ret_conv;
45491 }
45492
45493 uint64_t  __attribute__((export_name("TS_ExpiryTime_from_seconds"))) TS_ExpiryTime_from_seconds(int64_t seconds) {
45494         LDKExpiryTime ret_var = ExpiryTime_from_seconds(seconds);
45495         uint64_t ret_ref = 0;
45496         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45497         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45498         return ret_ref;
45499 }
45500
45501 uint64_t  __attribute__((export_name("TS_ExpiryTime_from_duration"))) TS_ExpiryTime_from_duration(int64_t duration) {
45502         LDKExpiryTime ret_var = ExpiryTime_from_duration(duration);
45503         uint64_t ret_ref = 0;
45504         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45505         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45506         return ret_ref;
45507 }
45508
45509 int64_t  __attribute__((export_name("TS_ExpiryTime_as_seconds"))) TS_ExpiryTime_as_seconds(uint64_t this_arg) {
45510         LDKExpiryTime this_arg_conv;
45511         this_arg_conv.inner = untag_ptr(this_arg);
45512         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45514         this_arg_conv.is_owned = false;
45515         int64_t ret_conv = ExpiryTime_as_seconds(&this_arg_conv);
45516         return ret_conv;
45517 }
45518
45519 int64_t  __attribute__((export_name("TS_ExpiryTime_as_duration"))) TS_ExpiryTime_as_duration(uint64_t this_arg) {
45520         LDKExpiryTime this_arg_conv;
45521         this_arg_conv.inner = untag_ptr(this_arg);
45522         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45524         this_arg_conv.is_owned = false;
45525         int64_t ret_conv = ExpiryTime_as_duration(&this_arg_conv);
45526         return ret_conv;
45527 }
45528
45529 uint64_t  __attribute__((export_name("TS_PrivateRoute_new"))) TS_PrivateRoute_new(uint64_t hops) {
45530         LDKRouteHint hops_conv;
45531         hops_conv.inner = untag_ptr(hops);
45532         hops_conv.is_owned = ptr_is_owned(hops);
45533         CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv);
45534         hops_conv = RouteHint_clone(&hops_conv);
45535         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
45536         *ret_conv = PrivateRoute_new(hops_conv);
45537         return tag_ptr(ret_conv, true);
45538 }
45539
45540 uint64_t  __attribute__((export_name("TS_PrivateRoute_into_inner"))) TS_PrivateRoute_into_inner(uint64_t this_arg) {
45541         LDKPrivateRoute this_arg_conv;
45542         this_arg_conv.inner = untag_ptr(this_arg);
45543         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45545         this_arg_conv = PrivateRoute_clone(&this_arg_conv);
45546         LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
45547         uint64_t ret_ref = 0;
45548         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45549         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45550         return ret_ref;
45551 }
45552
45553 uint32_t  __attribute__((export_name("TS_CreationError_clone"))) TS_CreationError_clone(uint64_t orig) {
45554         LDKCreationError* orig_conv = (LDKCreationError*)untag_ptr(orig);
45555         uint32_t ret_conv = LDKCreationError_to_js(CreationError_clone(orig_conv));
45556         return ret_conv;
45557 }
45558
45559 uint32_t  __attribute__((export_name("TS_CreationError_description_too_long"))) TS_CreationError_description_too_long() {
45560         uint32_t ret_conv = LDKCreationError_to_js(CreationError_description_too_long());
45561         return ret_conv;
45562 }
45563
45564 uint32_t  __attribute__((export_name("TS_CreationError_route_too_long"))) TS_CreationError_route_too_long() {
45565         uint32_t ret_conv = LDKCreationError_to_js(CreationError_route_too_long());
45566         return ret_conv;
45567 }
45568
45569 uint32_t  __attribute__((export_name("TS_CreationError_timestamp_out_of_bounds"))) TS_CreationError_timestamp_out_of_bounds() {
45570         uint32_t ret_conv = LDKCreationError_to_js(CreationError_timestamp_out_of_bounds());
45571         return ret_conv;
45572 }
45573
45574 uint32_t  __attribute__((export_name("TS_CreationError_invalid_amount"))) TS_CreationError_invalid_amount() {
45575         uint32_t ret_conv = LDKCreationError_to_js(CreationError_invalid_amount());
45576         return ret_conv;
45577 }
45578
45579 uint32_t  __attribute__((export_name("TS_CreationError_missing_route_hints"))) TS_CreationError_missing_route_hints() {
45580         uint32_t ret_conv = LDKCreationError_to_js(CreationError_missing_route_hints());
45581         return ret_conv;
45582 }
45583
45584 jboolean  __attribute__((export_name("TS_CreationError_eq"))) TS_CreationError_eq(uint64_t a, uint64_t b) {
45585         LDKCreationError* a_conv = (LDKCreationError*)untag_ptr(a);
45586         LDKCreationError* b_conv = (LDKCreationError*)untag_ptr(b);
45587         jboolean ret_conv = CreationError_eq(a_conv, b_conv);
45588         return ret_conv;
45589 }
45590
45591 jstring  __attribute__((export_name("TS_CreationError_to_str"))) TS_CreationError_to_str(uint64_t o) {
45592         LDKCreationError* o_conv = (LDKCreationError*)untag_ptr(o);
45593         LDKStr ret_str = CreationError_to_str(o_conv);
45594         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
45595         Str_free(ret_str);
45596         return ret_conv;
45597 }
45598
45599 uint32_t  __attribute__((export_name("TS_SemanticError_clone"))) TS_SemanticError_clone(uint64_t orig) {
45600         LDKSemanticError* orig_conv = (LDKSemanticError*)untag_ptr(orig);
45601         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_clone(orig_conv));
45602         return ret_conv;
45603 }
45604
45605 uint32_t  __attribute__((export_name("TS_SemanticError_no_payment_hash"))) TS_SemanticError_no_payment_hash() {
45606         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_hash());
45607         return ret_conv;
45608 }
45609
45610 uint32_t  __attribute__((export_name("TS_SemanticError_multiple_payment_hashes"))) TS_SemanticError_multiple_payment_hashes() {
45611         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_hashes());
45612         return ret_conv;
45613 }
45614
45615 uint32_t  __attribute__((export_name("TS_SemanticError_no_description"))) TS_SemanticError_no_description() {
45616         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_description());
45617         return ret_conv;
45618 }
45619
45620 uint32_t  __attribute__((export_name("TS_SemanticError_multiple_descriptions"))) TS_SemanticError_multiple_descriptions() {
45621         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_descriptions());
45622         return ret_conv;
45623 }
45624
45625 uint32_t  __attribute__((export_name("TS_SemanticError_no_payment_secret"))) TS_SemanticError_no_payment_secret() {
45626         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_secret());
45627         return ret_conv;
45628 }
45629
45630 uint32_t  __attribute__((export_name("TS_SemanticError_multiple_payment_secrets"))) TS_SemanticError_multiple_payment_secrets() {
45631         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_secrets());
45632         return ret_conv;
45633 }
45634
45635 uint32_t  __attribute__((export_name("TS_SemanticError_invalid_features"))) TS_SemanticError_invalid_features() {
45636         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_features());
45637         return ret_conv;
45638 }
45639
45640 uint32_t  __attribute__((export_name("TS_SemanticError_invalid_recovery_id"))) TS_SemanticError_invalid_recovery_id() {
45641         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_recovery_id());
45642         return ret_conv;
45643 }
45644
45645 uint32_t  __attribute__((export_name("TS_SemanticError_invalid_signature"))) TS_SemanticError_invalid_signature() {
45646         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_signature());
45647         return ret_conv;
45648 }
45649
45650 uint32_t  __attribute__((export_name("TS_SemanticError_imprecise_amount"))) TS_SemanticError_imprecise_amount() {
45651         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_imprecise_amount());
45652         return ret_conv;
45653 }
45654
45655 jboolean  __attribute__((export_name("TS_SemanticError_eq"))) TS_SemanticError_eq(uint64_t a, uint64_t b) {
45656         LDKSemanticError* a_conv = (LDKSemanticError*)untag_ptr(a);
45657         LDKSemanticError* b_conv = (LDKSemanticError*)untag_ptr(b);
45658         jboolean ret_conv = SemanticError_eq(a_conv, b_conv);
45659         return ret_conv;
45660 }
45661
45662 jstring  __attribute__((export_name("TS_SemanticError_to_str"))) TS_SemanticError_to_str(uint64_t o) {
45663         LDKSemanticError* o_conv = (LDKSemanticError*)untag_ptr(o);
45664         LDKStr ret_str = SemanticError_to_str(o_conv);
45665         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
45666         Str_free(ret_str);
45667         return ret_conv;
45668 }
45669
45670 void  __attribute__((export_name("TS_SignOrCreationError_free"))) TS_SignOrCreationError_free(uint64_t this_ptr) {
45671         if (!ptr_is_owned(this_ptr)) return;
45672         void* this_ptr_ptr = untag_ptr(this_ptr);
45673         CHECK_ACCESS(this_ptr_ptr);
45674         LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
45675         FREE(untag_ptr(this_ptr));
45676         SignOrCreationError_free(this_ptr_conv);
45677 }
45678
45679 static inline uint64_t SignOrCreationError_clone_ptr(LDKSignOrCreationError *NONNULL_PTR arg) {
45680         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
45681         *ret_copy = SignOrCreationError_clone(arg);
45682         uint64_t ret_ref = tag_ptr(ret_copy, true);
45683         return ret_ref;
45684 }
45685 int64_t  __attribute__((export_name("TS_SignOrCreationError_clone_ptr"))) TS_SignOrCreationError_clone_ptr(uint64_t arg) {
45686         LDKSignOrCreationError* arg_conv = (LDKSignOrCreationError*)untag_ptr(arg);
45687         int64_t ret_conv = SignOrCreationError_clone_ptr(arg_conv);
45688         return ret_conv;
45689 }
45690
45691 uint64_t  __attribute__((export_name("TS_SignOrCreationError_clone"))) TS_SignOrCreationError_clone(uint64_t orig) {
45692         LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)untag_ptr(orig);
45693         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
45694         *ret_copy = SignOrCreationError_clone(orig_conv);
45695         uint64_t ret_ref = tag_ptr(ret_copy, true);
45696         return ret_ref;
45697 }
45698
45699 uint64_t  __attribute__((export_name("TS_SignOrCreationError_sign_error"))) TS_SignOrCreationError_sign_error() {
45700         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
45701         *ret_copy = SignOrCreationError_sign_error();
45702         uint64_t ret_ref = tag_ptr(ret_copy, true);
45703         return ret_ref;
45704 }
45705
45706 uint64_t  __attribute__((export_name("TS_SignOrCreationError_creation_error"))) TS_SignOrCreationError_creation_error(uint32_t a) {
45707         LDKCreationError a_conv = LDKCreationError_from_js(a);
45708         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
45709         *ret_copy = SignOrCreationError_creation_error(a_conv);
45710         uint64_t ret_ref = tag_ptr(ret_copy, true);
45711         return ret_ref;
45712 }
45713
45714 jboolean  __attribute__((export_name("TS_SignOrCreationError_eq"))) TS_SignOrCreationError_eq(uint64_t a, uint64_t b) {
45715         LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)untag_ptr(a);
45716         LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)untag_ptr(b);
45717         jboolean ret_conv = SignOrCreationError_eq(a_conv, b_conv);
45718         return ret_conv;
45719 }
45720
45721 jstring  __attribute__((export_name("TS_SignOrCreationError_to_str"))) TS_SignOrCreationError_to_str(uint64_t o) {
45722         LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)untag_ptr(o);
45723         LDKStr ret_str = SignOrCreationError_to_str(o_conv);
45724         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
45725         Str_free(ret_str);
45726         return ret_conv;
45727 }
45728
45729 void  __attribute__((export_name("TS_InvoicePayer_free"))) TS_InvoicePayer_free(uint64_t this_obj) {
45730         LDKInvoicePayer this_obj_conv;
45731         this_obj_conv.inner = untag_ptr(this_obj);
45732         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45734         InvoicePayer_free(this_obj_conv);
45735 }
45736
45737 void  __attribute__((export_name("TS_Payer_free"))) TS_Payer_free(uint64_t this_ptr) {
45738         if (!ptr_is_owned(this_ptr)) return;
45739         void* this_ptr_ptr = untag_ptr(this_ptr);
45740         CHECK_ACCESS(this_ptr_ptr);
45741         LDKPayer this_ptr_conv = *(LDKPayer*)(this_ptr_ptr);
45742         FREE(untag_ptr(this_ptr));
45743         Payer_free(this_ptr_conv);
45744 }
45745
45746 void  __attribute__((export_name("TS_Router_free"))) TS_Router_free(uint64_t this_ptr) {
45747         if (!ptr_is_owned(this_ptr)) return;
45748         void* this_ptr_ptr = untag_ptr(this_ptr);
45749         CHECK_ACCESS(this_ptr_ptr);
45750         LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
45751         FREE(untag_ptr(this_ptr));
45752         Router_free(this_ptr_conv);
45753 }
45754
45755 void  __attribute__((export_name("TS_Retry_free"))) TS_Retry_free(uint64_t this_ptr) {
45756         if (!ptr_is_owned(this_ptr)) return;
45757         void* this_ptr_ptr = untag_ptr(this_ptr);
45758         CHECK_ACCESS(this_ptr_ptr);
45759         LDKRetry this_ptr_conv = *(LDKRetry*)(this_ptr_ptr);
45760         FREE(untag_ptr(this_ptr));
45761         Retry_free(this_ptr_conv);
45762 }
45763
45764 static inline uint64_t Retry_clone_ptr(LDKRetry *NONNULL_PTR arg) {
45765         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
45766         *ret_copy = Retry_clone(arg);
45767         uint64_t ret_ref = tag_ptr(ret_copy, true);
45768         return ret_ref;
45769 }
45770 int64_t  __attribute__((export_name("TS_Retry_clone_ptr"))) TS_Retry_clone_ptr(uint64_t arg) {
45771         LDKRetry* arg_conv = (LDKRetry*)untag_ptr(arg);
45772         int64_t ret_conv = Retry_clone_ptr(arg_conv);
45773         return ret_conv;
45774 }
45775
45776 uint64_t  __attribute__((export_name("TS_Retry_clone"))) TS_Retry_clone(uint64_t orig) {
45777         LDKRetry* orig_conv = (LDKRetry*)untag_ptr(orig);
45778         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
45779         *ret_copy = Retry_clone(orig_conv);
45780         uint64_t ret_ref = tag_ptr(ret_copy, true);
45781         return ret_ref;
45782 }
45783
45784 uint64_t  __attribute__((export_name("TS_Retry_attempts"))) TS_Retry_attempts(uint32_t a) {
45785         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
45786         *ret_copy = Retry_attempts(a);
45787         uint64_t ret_ref = tag_ptr(ret_copy, true);
45788         return ret_ref;
45789 }
45790
45791 jboolean  __attribute__((export_name("TS_Retry_eq"))) TS_Retry_eq(uint64_t a, uint64_t b) {
45792         LDKRetry* a_conv = (LDKRetry*)untag_ptr(a);
45793         LDKRetry* b_conv = (LDKRetry*)untag_ptr(b);
45794         jboolean ret_conv = Retry_eq(a_conv, b_conv);
45795         return ret_conv;
45796 }
45797
45798 int64_t  __attribute__((export_name("TS_Retry_hash"))) TS_Retry_hash(uint64_t o) {
45799         LDKRetry* o_conv = (LDKRetry*)untag_ptr(o);
45800         int64_t ret_conv = Retry_hash(o_conv);
45801         return ret_conv;
45802 }
45803
45804 void  __attribute__((export_name("TS_PaymentError_free"))) TS_PaymentError_free(uint64_t this_ptr) {
45805         if (!ptr_is_owned(this_ptr)) return;
45806         void* this_ptr_ptr = untag_ptr(this_ptr);
45807         CHECK_ACCESS(this_ptr_ptr);
45808         LDKPaymentError this_ptr_conv = *(LDKPaymentError*)(this_ptr_ptr);
45809         FREE(untag_ptr(this_ptr));
45810         PaymentError_free(this_ptr_conv);
45811 }
45812
45813 static inline uint64_t PaymentError_clone_ptr(LDKPaymentError *NONNULL_PTR arg) {
45814         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
45815         *ret_copy = PaymentError_clone(arg);
45816         uint64_t ret_ref = tag_ptr(ret_copy, true);
45817         return ret_ref;
45818 }
45819 int64_t  __attribute__((export_name("TS_PaymentError_clone_ptr"))) TS_PaymentError_clone_ptr(uint64_t arg) {
45820         LDKPaymentError* arg_conv = (LDKPaymentError*)untag_ptr(arg);
45821         int64_t ret_conv = PaymentError_clone_ptr(arg_conv);
45822         return ret_conv;
45823 }
45824
45825 uint64_t  __attribute__((export_name("TS_PaymentError_clone"))) TS_PaymentError_clone(uint64_t orig) {
45826         LDKPaymentError* orig_conv = (LDKPaymentError*)untag_ptr(orig);
45827         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
45828         *ret_copy = PaymentError_clone(orig_conv);
45829         uint64_t ret_ref = tag_ptr(ret_copy, true);
45830         return ret_ref;
45831 }
45832
45833 uint64_t  __attribute__((export_name("TS_PaymentError_invoice"))) TS_PaymentError_invoice(jstring a) {
45834         LDKStr a_conv = str_ref_to_owned_c(a);
45835         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
45836         *ret_copy = PaymentError_invoice(a_conv);
45837         uint64_t ret_ref = tag_ptr(ret_copy, true);
45838         return ret_ref;
45839 }
45840
45841 uint64_t  __attribute__((export_name("TS_PaymentError_routing"))) TS_PaymentError_routing(uint64_t a) {
45842         LDKLightningError a_conv;
45843         a_conv.inner = untag_ptr(a);
45844         a_conv.is_owned = ptr_is_owned(a);
45845         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45846         a_conv = LightningError_clone(&a_conv);
45847         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
45848         *ret_copy = PaymentError_routing(a_conv);
45849         uint64_t ret_ref = tag_ptr(ret_copy, true);
45850         return ret_ref;
45851 }
45852
45853 uint64_t  __attribute__((export_name("TS_PaymentError_sending"))) TS_PaymentError_sending(uint64_t a) {
45854         void* a_ptr = untag_ptr(a);
45855         CHECK_ACCESS(a_ptr);
45856         LDKPaymentSendFailure a_conv = *(LDKPaymentSendFailure*)(a_ptr);
45857         a_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(a));
45858         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
45859         *ret_copy = PaymentError_sending(a_conv);
45860         uint64_t ret_ref = tag_ptr(ret_copy, true);
45861         return ret_ref;
45862 }
45863
45864 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) {
45865         void* payer_ptr = untag_ptr(payer);
45866         CHECK_ACCESS(payer_ptr);
45867         LDKPayer payer_conv = *(LDKPayer*)(payer_ptr);
45868         if (payer_conv.free == LDKPayer_JCalls_free) {
45869                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45870                 LDKPayer_JCalls_cloned(&payer_conv);
45871         }
45872         void* router_ptr = untag_ptr(router);
45873         CHECK_ACCESS(router_ptr);
45874         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
45875         if (router_conv.free == LDKRouter_JCalls_free) {
45876                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45877                 LDKRouter_JCalls_cloned(&router_conv);
45878         }
45879         void* logger_ptr = untag_ptr(logger);
45880         CHECK_ACCESS(logger_ptr);
45881         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
45882         if (logger_conv.free == LDKLogger_JCalls_free) {
45883                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45884                 LDKLogger_JCalls_cloned(&logger_conv);
45885         }
45886         void* event_handler_ptr = untag_ptr(event_handler);
45887         CHECK_ACCESS(event_handler_ptr);
45888         LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
45889         if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
45890                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45891                 LDKEventHandler_JCalls_cloned(&event_handler_conv);
45892         }
45893         void* retry_ptr = untag_ptr(retry);
45894         CHECK_ACCESS(retry_ptr);
45895         LDKRetry retry_conv = *(LDKRetry*)(retry_ptr);
45896         retry_conv = Retry_clone((LDKRetry*)untag_ptr(retry));
45897         LDKInvoicePayer ret_var = InvoicePayer_new(payer_conv, router_conv, logger_conv, event_handler_conv, retry_conv);
45898         uint64_t ret_ref = 0;
45899         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45900         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45901         return ret_ref;
45902 }
45903
45904 uint64_t  __attribute__((export_name("TS_InvoicePayer_pay_invoice"))) TS_InvoicePayer_pay_invoice(uint64_t this_arg, uint64_t invoice) {
45905         LDKInvoicePayer this_arg_conv;
45906         this_arg_conv.inner = untag_ptr(this_arg);
45907         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45909         this_arg_conv.is_owned = false;
45910         LDKInvoice invoice_conv;
45911         invoice_conv.inner = untag_ptr(invoice);
45912         invoice_conv.is_owned = ptr_is_owned(invoice);
45913         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
45914         invoice_conv.is_owned = false;
45915         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
45916         *ret_conv = InvoicePayer_pay_invoice(&this_arg_conv, &invoice_conv);
45917         return tag_ptr(ret_conv, true);
45918 }
45919
45920 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) {
45921         LDKInvoicePayer this_arg_conv;
45922         this_arg_conv.inner = untag_ptr(this_arg);
45923         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45925         this_arg_conv.is_owned = false;
45926         LDKInvoice invoice_conv;
45927         invoice_conv.inner = untag_ptr(invoice);
45928         invoice_conv.is_owned = ptr_is_owned(invoice);
45929         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
45930         invoice_conv.is_owned = false;
45931         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
45932         *ret_conv = InvoicePayer_pay_zero_value_invoice(&this_arg_conv, &invoice_conv, amount_msats);
45933         return tag_ptr(ret_conv, true);
45934 }
45935
45936 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) {
45937         LDKInvoicePayer this_arg_conv;
45938         this_arg_conv.inner = untag_ptr(this_arg);
45939         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45941         this_arg_conv.is_owned = false;
45942         LDKPublicKey pubkey_ref;
45943         CHECK(pubkey->arr_len == 33);
45944         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
45945         LDKThirtyTwoBytes payment_preimage_ref;
45946         CHECK(payment_preimage->arr_len == 32);
45947         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
45948         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
45949         *ret_conv = InvoicePayer_pay_pubkey(&this_arg_conv, pubkey_ref, payment_preimage_ref, amount_msats, final_cltv_expiry_delta);
45950         return tag_ptr(ret_conv, true);
45951 }
45952
45953 void  __attribute__((export_name("TS_InvoicePayer_remove_cached_payment"))) TS_InvoicePayer_remove_cached_payment(uint64_t this_arg, int8_tArray payment_hash) {
45954         LDKInvoicePayer this_arg_conv;
45955         this_arg_conv.inner = untag_ptr(this_arg);
45956         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45958         this_arg_conv.is_owned = false;
45959         unsigned char payment_hash_arr[32];
45960         CHECK(payment_hash->arr_len == 32);
45961         memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
45962         unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
45963         InvoicePayer_remove_cached_payment(&this_arg_conv, payment_hash_ref);
45964 }
45965
45966 uint64_t  __attribute__((export_name("TS_InvoicePayer_as_EventHandler"))) TS_InvoicePayer_as_EventHandler(uint64_t this_arg) {
45967         LDKInvoicePayer this_arg_conv;
45968         this_arg_conv.inner = untag_ptr(this_arg);
45969         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45971         this_arg_conv.is_owned = false;
45972         LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
45973         *ret_ret = InvoicePayer_as_EventHandler(&this_arg_conv);
45974         return tag_ptr(ret_ret, true);
45975 }
45976
45977 void  __attribute__((export_name("TS_InFlightHtlcs_free"))) TS_InFlightHtlcs_free(uint64_t this_obj) {
45978         LDKInFlightHtlcs this_obj_conv;
45979         this_obj_conv.inner = untag_ptr(this_obj);
45980         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45982         InFlightHtlcs_free(this_obj_conv);
45983 }
45984
45985 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) {
45986         LDKInFlightHtlcs this_arg_conv;
45987         this_arg_conv.inner = untag_ptr(this_arg);
45988         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45990         this_arg_conv.is_owned = false;
45991         LDKNodeId source_conv;
45992         source_conv.inner = untag_ptr(source);
45993         source_conv.is_owned = ptr_is_owned(source);
45994         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
45995         source_conv.is_owned = false;
45996         LDKNodeId target_conv;
45997         target_conv.inner = untag_ptr(target);
45998         target_conv.is_owned = ptr_is_owned(target);
45999         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
46000         target_conv.is_owned = false;
46001         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
46002         *ret_copy = InFlightHtlcs_used_liquidity_msat(&this_arg_conv, &source_conv, &target_conv, channel_scid);
46003         uint64_t ret_ref = tag_ptr(ret_copy, true);
46004         return ret_ref;
46005 }
46006
46007 int8_tArray  __attribute__((export_name("TS_InFlightHtlcs_write"))) TS_InFlightHtlcs_write(uint64_t obj) {
46008         LDKInFlightHtlcs obj_conv;
46009         obj_conv.inner = untag_ptr(obj);
46010         obj_conv.is_owned = ptr_is_owned(obj);
46011         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46012         obj_conv.is_owned = false;
46013         LDKCVec_u8Z ret_var = InFlightHtlcs_write(&obj_conv);
46014         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46015         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46016         CVec_u8Z_free(ret_var);
46017         return ret_arr;
46018 }
46019
46020 uint64_t  __attribute__((export_name("TS_InFlightHtlcs_read"))) TS_InFlightHtlcs_read(int8_tArray ser) {
46021         LDKu8slice ser_ref;
46022         ser_ref.datalen = ser->arr_len;
46023         ser_ref.data = ser->elems;
46024         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
46025         *ret_conv = InFlightHtlcs_read(ser_ref);
46026         FREE(ser);
46027         return tag_ptr(ret_conv, true);
46028 }
46029
46030 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) {
46031         LDKChannelManager channelmanager_conv;
46032         channelmanager_conv.inner = untag_ptr(channelmanager);
46033         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
46034         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
46035         channelmanager_conv.is_owned = false;
46036         void* keys_manager_ptr = untag_ptr(keys_manager);
46037         CHECK_ACCESS(keys_manager_ptr);
46038         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
46039         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
46040                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46041                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
46042         }
46043         LDKCurrency network_conv = LDKCurrency_from_js(network);
46044         void* amt_msat_ptr = untag_ptr(amt_msat);
46045         CHECK_ACCESS(amt_msat_ptr);
46046         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
46047         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
46048         LDKSha256 description_hash_conv;
46049         description_hash_conv.inner = untag_ptr(description_hash);
46050         description_hash_conv.is_owned = ptr_is_owned(description_hash);
46051         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
46052         description_hash_conv = Sha256_clone(&description_hash_conv);
46053         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
46054         *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);
46055         return tag_ptr(ret_conv, true);
46056 }
46057
46058 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) {
46059         LDKChannelManager channelmanager_conv;
46060         channelmanager_conv.inner = untag_ptr(channelmanager);
46061         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
46062         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
46063         channelmanager_conv.is_owned = false;
46064         void* keys_manager_ptr = untag_ptr(keys_manager);
46065         CHECK_ACCESS(keys_manager_ptr);
46066         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
46067         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
46068                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46069                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
46070         }
46071         LDKCurrency network_conv = LDKCurrency_from_js(network);
46072         void* amt_msat_ptr = untag_ptr(amt_msat);
46073         CHECK_ACCESS(amt_msat_ptr);
46074         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
46075         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
46076         LDKStr description_conv = str_ref_to_owned_c(description);
46077         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
46078         *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);
46079         return tag_ptr(ret_conv, true);
46080 }
46081
46082 void  __attribute__((export_name("TS_DefaultRouter_free"))) TS_DefaultRouter_free(uint64_t this_obj) {
46083         LDKDefaultRouter this_obj_conv;
46084         this_obj_conv.inner = untag_ptr(this_obj);
46085         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46087         DefaultRouter_free(this_obj_conv);
46088 }
46089
46090 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) {
46091         LDKNetworkGraph network_graph_conv;
46092         network_graph_conv.inner = untag_ptr(network_graph);
46093         network_graph_conv.is_owned = ptr_is_owned(network_graph);
46094         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
46095         network_graph_conv.is_owned = false;
46096         void* logger_ptr = untag_ptr(logger);
46097         CHECK_ACCESS(logger_ptr);
46098         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
46099         if (logger_conv.free == LDKLogger_JCalls_free) {
46100                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46101                 LDKLogger_JCalls_cloned(&logger_conv);
46102         }
46103         LDKThirtyTwoBytes random_seed_bytes_ref;
46104         CHECK(random_seed_bytes->arr_len == 32);
46105         memcpy(random_seed_bytes_ref.data, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
46106         void* scorer_ptr = untag_ptr(scorer);
46107         CHECK_ACCESS(scorer_ptr);
46108         LDKLockableScore scorer_conv = *(LDKLockableScore*)(scorer_ptr);
46109         if (scorer_conv.free == LDKLockableScore_JCalls_free) {
46110                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46111                 LDKLockableScore_JCalls_cloned(&scorer_conv);
46112         }
46113         LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv, random_seed_bytes_ref, scorer_conv);
46114         uint64_t ret_ref = 0;
46115         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46116         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46117         return ret_ref;
46118 }
46119
46120 uint64_t  __attribute__((export_name("TS_DefaultRouter_as_Router"))) TS_DefaultRouter_as_Router(uint64_t this_arg) {
46121         LDKDefaultRouter this_arg_conv;
46122         this_arg_conv.inner = untag_ptr(this_arg);
46123         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46125         this_arg_conv.is_owned = false;
46126         LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
46127         *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
46128         return tag_ptr(ret_ret, true);
46129 }
46130
46131 uint64_t  __attribute__((export_name("TS_ChannelManager_as_Payer"))) TS_ChannelManager_as_Payer(uint64_t this_arg) {
46132         LDKChannelManager this_arg_conv;
46133         this_arg_conv.inner = untag_ptr(this_arg);
46134         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46135         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46136         this_arg_conv.is_owned = false;
46137         LDKPayer* ret_ret = MALLOC(sizeof(LDKPayer), "LDKPayer");
46138         *ret_ret = ChannelManager_as_Payer(&this_arg_conv);
46139         return tag_ptr(ret_ret, true);
46140 }
46141
46142 uint64_t  __attribute__((export_name("TS_SiPrefix_from_str"))) TS_SiPrefix_from_str(jstring s) {
46143         LDKStr s_conv = str_ref_to_owned_c(s);
46144         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
46145         *ret_conv = SiPrefix_from_str(s_conv);
46146         return tag_ptr(ret_conv, true);
46147 }
46148
46149 uint64_t  __attribute__((export_name("TS_Invoice_from_str"))) TS_Invoice_from_str(jstring s) {
46150         LDKStr s_conv = str_ref_to_owned_c(s);
46151         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
46152         *ret_conv = Invoice_from_str(s_conv);
46153         return tag_ptr(ret_conv, true);
46154 }
46155
46156 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_from_str"))) TS_SignedRawInvoice_from_str(jstring s) {
46157         LDKStr s_conv = str_ref_to_owned_c(s);
46158         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
46159         *ret_conv = SignedRawInvoice_from_str(s_conv);
46160         return tag_ptr(ret_conv, true);
46161 }
46162
46163 jstring  __attribute__((export_name("TS_ParseError_to_str"))) TS_ParseError_to_str(uint64_t o) {
46164         LDKParseError* o_conv = (LDKParseError*)untag_ptr(o);
46165         LDKStr ret_str = ParseError_to_str(o_conv);
46166         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
46167         Str_free(ret_str);
46168         return ret_conv;
46169 }
46170
46171 jstring  __attribute__((export_name("TS_ParseOrSemanticError_to_str"))) TS_ParseOrSemanticError_to_str(uint64_t o) {
46172         LDKParseOrSemanticError* o_conv = (LDKParseOrSemanticError*)untag_ptr(o);
46173         LDKStr ret_str = ParseOrSemanticError_to_str(o_conv);
46174         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
46175         Str_free(ret_str);
46176         return ret_conv;
46177 }
46178
46179 jstring  __attribute__((export_name("TS_Invoice_to_str"))) TS_Invoice_to_str(uint64_t o) {
46180         LDKInvoice o_conv;
46181         o_conv.inner = untag_ptr(o);
46182         o_conv.is_owned = ptr_is_owned(o);
46183         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46184         o_conv.is_owned = false;
46185         LDKStr ret_str = Invoice_to_str(&o_conv);
46186         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
46187         Str_free(ret_str);
46188         return ret_conv;
46189 }
46190
46191 jstring  __attribute__((export_name("TS_SignedRawInvoice_to_str"))) TS_SignedRawInvoice_to_str(uint64_t o) {
46192         LDKSignedRawInvoice o_conv;
46193         o_conv.inner = untag_ptr(o);
46194         o_conv.is_owned = ptr_is_owned(o);
46195         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46196         o_conv.is_owned = false;
46197         LDKStr ret_str = SignedRawInvoice_to_str(&o_conv);
46198         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
46199         Str_free(ret_str);
46200         return ret_conv;
46201 }
46202
46203 jstring  __attribute__((export_name("TS_Currency_to_str"))) TS_Currency_to_str(uint64_t o) {
46204         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
46205         LDKStr ret_str = Currency_to_str(o_conv);
46206         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
46207         Str_free(ret_str);
46208         return ret_conv;
46209 }
46210
46211 jstring  __attribute__((export_name("TS_SiPrefix_to_str"))) TS_SiPrefix_to_str(uint64_t o) {
46212         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
46213         LDKStr ret_str = SiPrefix_to_str(o_conv);
46214         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
46215         Str_free(ret_str);
46216         return ret_conv;
46217 }
46218